Hello..

this looks fine.. and is better than just adding DT_UNKOWN 8)

i additionally patched the cgroup-util.c (see attachment)

thx for the patch..

m.


On 03/03/11 16:27, Andrey Borzenkov wrote:
Some file systems (at least, reiserfs) return DT_UNKNOWN for
every directory entry in readdir(). So far in several places
systemd filtered on DT_REG/DT_LNK and so skipped any file on
such filesystems. It affected systemd-update-utmp, systemd-modules-load
and systemd-tty-ask-password-agent.

This patch adds additional stat() check for file type for DT_UNKNOWN
case. Additionally, it adds check that DT_LNK really points to
regular file.

The patch fixes misterious runlevel entry in utmp discussed in
http://lists.freedesktop.org/archives/systemd-devel/2011-March/001433.html

Reported-By: [email protected]
Signed-off-by: Andrey Borzenkov<[email protected]>

---
  src/modules-load.c           |  137 +++++++++++++++++++++++-------------------
  src/tmpfiles.c               |   22 ++++---
  src/tty-ask-password-agent.c |    8 ++-
  3 files changed, 94 insertions(+), 73 deletions(-)

--
Dipl.-Inf. Marius Tolzmann <[email protected]>
----------------------------------.------------------------------
MPI f. molekulare Genetik         |
Ihnestrasse 63-73, D-14195 Berlin |   ==> MarIuX GNU/Linux <==
Phone: +49 (0)30 8413 1709        |
----------------------------------^------------------------------
God put me on earth to accomplish a certain number of things.
Right now I am so far behind..
   ..I will never die.         <by calvin from calvin&hobbes ;)>
diff -Naur systemd-19.orig/src/cgroup-util.c systemd-19/src/cgroup-util.c
--- systemd-19.orig/src/cgroup-util.c   2011-02-21 13:40:01.000000000 +0100
+++ systemd-19/src/cgroup-util.c        2011-03-03 16:27:25.000000000 +0100
@@ -133,7 +133,18 @@
         while ((de = readdir(d))) {
                 char *b;
 
-                if (de->d_type != DT_DIR)
+                if (de->d_type == DT_UNKNOWN) {
+                        struct stat st;
+
+                        if (fstatat(dirfd(d), de->d_name, &st, 
AT_SYMLINK_NOFOLLOW) < 0) {
+                                r = -errno;
+                                goto finish;
+                        }
+                        is_dir = S_ISDIR(st.st_mode);
+                } else
+                        is_dir = de->d_type == DT_DIR;
+
+                if (!is_dir)
                         continue;
 
                 if (streq(de->d_name, ".") ||
_______________________________________________
systemd-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/systemd-devel

Reply via email to