mirror of the now-defunct rocklinux.org
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

38 lines
1.4 KiB

  1. Index: kstandarddirs.cpp
  2. ===================================================================
  3. RCS file: /home/kde/kdelibs/kdecore/kstandarddirs.cpp,v
  4. retrieving revision 1.168.2.3
  5. retrieving revision 1.168.2.4
  6. diff -u -p -r1.168.2.3 -r1.168.2.4
  7. --- kde-old/kdecore/kstandarddirs.cpp 8 Jun 2004 09:27:57 -0000 1.168.2.3
  8. +++ kde-new/kdecore/kstandarddirs.cpp 26 Jun 2004 14:42:16 -0000 1.168.2.4
  9. @@ -651,7 +651,28 @@ void KStandardDirs::createSpecialResourc
  10. char link[1024];
  11. link[1023] = 0;
  12. int result = readlink(QFile::encodeName(dir).data(), link, 1023);
  13. - if ((result == -1) && (errno == ENOENT))
  14. + bool relink = (result == -1) && (errno == ENOENT);
  15. + if ((result > 0) && (link[0] == '/'))
  16. + {
  17. + link[result] = 0;
  18. + struct stat stat_buf;
  19. + int res = lstat(link, &stat_buf);
  20. + if ((res == -1) && (errno == ENOENT))
  21. + {
  22. + relink = true;
  23. + }
  24. + else if ((res == -1) || (!S_ISDIR(stat_buf.st_mode)))
  25. + {
  26. + fprintf(stderr, "Error: \"%s\" is not a directory.\n", link);
  27. + relink = true;
  28. + }
  29. + else if (stat_buf.st_uid != getuid())
  30. + {
  31. + fprintf(stderr, "Error: \"%s\" is owned by uid %d instead of uid %d.\n", link, stat_buf.st_uid, getuid());
  32. + relink = true;
  33. + }
  34. + }
  35. + if (relink)
  36. {
  37. QString srv = findExe(QString::fromLatin1("lnusertemp"), KDEDIR+QString::fromLatin1("/bin"));
  38. if (srv.isEmpty())