]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
libfdisk: use O_CLOEXEC
authorKarel Zak <kzak@redhat.com>
Wed, 3 Apr 2013 14:13:45 +0000 (16:13 +0200)
committerKarel Zak <kzak@redhat.com>
Wed, 3 Apr 2013 14:13:45 +0000 (16:13 +0200)
Signed-off-by: Karel Zak <kzak@redhat.com>
libfdisk/src/context.c

index da2d5588aab0f5b6253bbab027ccf15a50309294..c9613926caf46fae7b50bd992ade1eaf7f064bc2 100644 (file)
@@ -158,8 +158,8 @@ int fdisk_context_assign_device(struct fdisk_context *cxt,
 
        reset_context(cxt);
 
-       if (readonly == 1 || (fd = open(fname, O_RDWR)) < 0) {
-               if ((fd = open(fname, O_RDONLY)) < 0)
+       if (readonly == 1 || (fd = open(fname, O_RDWR|O_CLOEXEC)) < 0) {
+               if ((fd = open(fname, O_RDONLY|O_CLOEXEC)) < 0)
                        return -errno;
                readonly = 1;
        }