diff options
Diffstat (limited to 'lib/e2p/fsetflags.c')
-rw-r--r-- | lib/e2p/fsetflags.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/lib/e2p/fsetflags.c b/lib/e2p/fsetflags.c index 35266dcd..6942c045 100644 --- a/lib/e2p/fsetflags.c +++ b/lib/e2p/fsetflags.c @@ -59,14 +59,18 @@ int fsetflags (const char * name, unsigned long flags) return chflags (name, bsd_flags); #else #if HAVE_EXT2_IOCTLS - int fd, r, f; + int fd, r, f, save_errno = 0; fd = open (name, OPEN_FLAGS); if (fd == -1) return -1; f = (int) flags; r = ioctl (fd, EXT2_IOC_SETFLAGS, &f); + if (r == -1) + save_errno = errno; close (fd); + if (save_errno) + errno = save_errno; return r; #else /* ! HAVE_EXT2_IOCTLS */ extern int errno; |