|
Lines 650-656
void KStandardDirs::createSpecialResourc
Link Here
|
| 650 |
char link[1024]; |
650 |
char link[1024]; |
| 651 |
link[1023] = 0; |
651 |
link[1023] = 0; |
| 652 |
int result = readlink(QFile::encodeName(dir).data(), link, 1023); |
652 |
int result = readlink(QFile::encodeName(dir).data(), link, 1023); |
| 653 |
if ((result == -1) && (errno == ENOENT)) |
653 |
bool relink = (result == -1) && (errno == ENOENT); |
|
|
654 |
if ((result > 0) && (link[0] == '/')) |
| 655 |
{ |
| 656 |
link[result] = 0; |
| 657 |
struct stat stat_buf; |
| 658 |
int res = lstat(link, &stat_buf); |
| 659 |
if ((res == -1) && (errno == ENOENT)) |
| 660 |
{ |
| 661 |
relink = true; |
| 662 |
} |
| 663 |
else if ((res == -1) || (!S_ISDIR(stat_buf.st_mode))) |
| 664 |
{ |
| 665 |
fprintf(stderr, "Error: \"%s\" is not a directory.\n", link); |
| 666 |
relink = true; |
| 667 |
} |
| 668 |
else if (stat_buf.st_uid != getuid()) |
| 669 |
{ |
| 670 |
fprintf(stderr, "Error: \"%s\" is owned by uid %d instead of uid %d.\n", link, stat_buf.st_uid, getuid()); |
| 671 |
relink = true; |
| 672 |
} |
| 673 |
} |
| 674 |
if (relink) |
| 654 |
{ |
675 |
{ |
| 655 |
QString srv = findExe(QString::fromLatin1("lnusertemp"), KDEDIR+QString::fromLatin1("/bin")); |
676 |
QString srv = findExe(QString::fromLatin1("lnusertemp"), KDEDIR+QString::fromLatin1("/bin")); |
| 656 |
if (srv.isEmpty()) |
677 |
if (srv.isEmpty()) |