diff options
author | Theodore Ts'o <tytso@mit.edu> | 2007-10-22 01:36:13 -0400 |
---|---|---|
committer | Theodore Ts'o <tytso@mit.edu> | 2007-10-22 08:05:44 -0400 |
commit | 1a4ce9df5884405a7152855b868c3a7bfbeec385 (patch) | |
tree | 0af125d3743004b75fd9ac493941f04940d4ba17 | |
parent | 042a27f8230804062016194ce151baa6cfff034e (diff) | |
download | e2fsprogs-1a4ce9df5884405a7152855b868c3a7bfbeec385.tar.gz |
libe2p: Use lstat() instead of stat() in fsetflags() and fgetflags()
We can't set the flags on symbolic links, so check for them using
lstat().
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
-rw-r--r-- | lib/e2p/fgetflags.c | 2 | ||||
-rw-r--r-- | lib/e2p/fsetflags.c | 2 |
2 files changed, 2 insertions, 2 deletions
diff --git a/lib/e2p/fgetflags.c b/lib/e2p/fgetflags.c index 0aed6c82..372304fb 100644 --- a/lib/e2p/fgetflags.c +++ b/lib/e2p/fgetflags.c @@ -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; } diff --git a/lib/e2p/fsetflags.c b/lib/e2p/fsetflags.c index 2f1277fd..3a053240 100644 --- a/lib/e2p/fsetflags.c +++ b/lib/e2p/fsetflags.c @@ -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; } |