]>
git.ipfire.org Git - thirdparty/e2fsprogs.git/blob - lib/e2p/getflags.c
e8716848785ff30197d731202f9d5c2f8c5983b0
2 * getflags.c - Get a file flags on an ext2 file system
4 * Copyright (C) 1993, 1994 Remy Card <card@masi.ibp.fr>
5 * Laboratoire MASI, Institut Blaise Pascal
6 * Universite Pierre et Marie Curie (Paris VI)
9 * This file may be redistributed under the terms of the GNU Library
10 * General Public License, version 2.
22 #include <sys/types.h>
25 #include <sys/ioctl.h>
30 int getflags (int fd
, unsigned long * flags
)
35 if (fstat (fd
, &buf
) == -1)
40 if (buf
.st_flags
& UF_IMMUTABLE
)
41 *flags
|= EXT2_IMMUTABLE_FL
;
44 if (buf
.st_flags
& UF_APPEND
)
45 *flags
|= EXT2_APPEND_FL
;
48 if (buf
.st_flags
& UF_NODUMP
)
49 *flags
|= EXT2_NODUMP_FL
;
57 if (!fstat(fd
, &buf
) &&
58 !S_ISREG(buf
.st_mode
) && !S_ISDIR(buf
.st_mode
))
60 r
= ioctl(fd
, EXT2_IOC_GETFLAGS
, &f
);
65 #endif /* HAVE_EXT2_IOCTLS */