summaryrefslogtreecommitdiffstats
path: root/lib/ismounted.c
diff options
context:
space:
mode:
authorKarel Zak2013-04-03 16:13:06 +0200
committerKarel Zak2013-04-03 16:13:06 +0200
commitb1fa3e2234fab95960eaa8499384000f189def13 (patch)
tree0db13933f5db07cb90cc40ff736829c11ad43509 /lib/ismounted.c
parentinclude/fileutils: use O_CLOEXEC for mktemp stuff (diff)
downloadkernel-qcow2-util-linux-b1fa3e2234fab95960eaa8499384000f189def13.tar.gz
kernel-qcow2-util-linux-b1fa3e2234fab95960eaa8499384000f189def13.tar.xz
kernel-qcow2-util-linux-b1fa3e2234fab95960eaa8499384000f189def13.zip
lib: use O_CLOEXEC in libcommon
Signed-off-by: Karel Zak <kzak@redhat.com>
Diffstat (limited to 'lib/ismounted.c')
-rw-r--r--lib/ismounted.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/lib/ismounted.c b/lib/ismounted.c
index d9f1f57d0..2463f3356 100644
--- a/lib/ismounted.c
+++ b/lib/ismounted.c
@@ -156,7 +156,7 @@ static int check_mntent_file(const char *mtab_file, const char *file,
is_root:
#define TEST_FILE "/.ismount-test-file"
*mount_flags |= MF_ISROOT;
- fd = open(TEST_FILE, O_RDWR|O_CREAT, 0600);
+ fd = open(TEST_FILE, O_RDWR|O_CREAT|O_CLOEXEC, 0600);
if (fd < 0) {
if (errno == EROFS)
*mount_flags |= MF_READONLY;
@@ -261,7 +261,7 @@ static int is_swap_device(const char *file)
file_dev = st_buf.st_rdev;
#endif /* __GNU__ */
- if (!(f = fopen("/proc/swaps", "r")))
+ if (!(f = fopen("/proc/swaps", "r" UL_CLOEXECSTR)))
return 0;
/* Skip the first line */
if (!fgets(buf, sizeof(buf), f))
@@ -339,7 +339,7 @@ int check_mount_point(const char *device, int *mount_flags,
if ((stat(device, &st_buf) != 0) ||
!S_ISBLK(st_buf.st_mode))
return 0;
- fd = open(device, O_RDONLY | O_EXCL);
+ fd = open(device, O_RDONLY|O_EXCL|O_CLOEXEC);
if (fd < 0) {
if (errno == EBUSY)
*mount_flags |= MF_BUSY;