Whamcloud - gitweb
libe2p: Use lstat() instead of stat() in fsetflags() and fgetflags()
authorTheodore Ts'o <tytso@mit.edu>
Mon, 22 Oct 2007 05:36:13 +0000 (01:36 -0400)
committerTheodore Ts'o <tytso@mit.edu>
Mon, 22 Oct 2007 12:05:44 +0000 (08:05 -0400)
We can't set the flags on symbolic links, so check for them using
lstat().

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
lib/e2p/fgetflags.c
lib/e2p/fsetflags.c

index 0aed6c8..372304f 100644 (file)
@@ -65,7 +65,7 @@ int fgetflags (const char * name, unsigned long * flags)
 #if HAVE_EXT2_IOCTLS
        int fd, r, f, save_errno = 0;
 
-       if (!stat(name, &buf) &&
+       if (!lstat(name, &buf) &&
            !S_ISREG(buf.st_mode) && !S_ISDIR(buf.st_mode)) {
                goto notsupp;
        }
index 2f1277f..3a05324 100644 (file)
@@ -71,7 +71,7 @@ int fsetflags (const char * name, unsigned long flags)
 #if HAVE_EXT2_IOCTLS
        int fd, r, f, save_errno = 0;
 
-       if (!stat(name, &buf) &&
+       if (!lstat(name, &buf) &&
            !S_ISREG(buf.st_mode) && !S_ISDIR(buf.st_mode)) {
                goto notsupp;
        }