summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorMike Frysinger <vapier@gentoo.org>2011-06-07 02:19:05 -0400
committerArtem Bityutskiy <Artem.Bityutskiy@nokia.com>2011-06-07 09:52:51 +0300
commit58ece20278fdc8730a017a1744afe717ccb771de (patch)
tree269dae08d56d6d387e21fca4019565c320b80709 /lib
parentf507ec5e6be795fcb67e472ce98fd084ac9bb1d1 (diff)
libmtd: use O_CLOEXEC
Not strictly necessary, but this is good library behavior and should carry no runtime overhead. Signed-off-by: Mike Frysinger <vapier@gentoo.org> Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
Diffstat (limited to 'lib')
-rw-r--r--lib/libmtd.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/lib/libmtd.c b/lib/libmtd.c
index 7fabd80..a651808 100644
--- a/lib/libmtd.c
+++ b/lib/libmtd.c
@@ -77,7 +77,7 @@ static int read_data(const char *file, void *buf, int buf_len)
{
int fd, rd, tmp, tmp1;
- fd = open(file, O_RDONLY);
+ fd = open(file, O_RDONLY | O_CLOEXEC);
if (fd == -1)
return -1;
@@ -201,7 +201,7 @@ static int read_hex_ll(const char *file, long long *value)
int fd, rd;
char buf[50];
- fd = open(file, O_RDONLY);
+ fd = open(file, O_RDONLY | O_CLOEXEC);
if (fd == -1)
return -1;
@@ -253,7 +253,7 @@ static int read_pos_ll(const char *file, long long *value)
int fd, rd;
char buf[50];
- fd = open(file, O_RDONLY);
+ fd = open(file, O_RDONLY | O_CLOEXEC);
if (fd == -1)
return -1;
@@ -538,7 +538,7 @@ static int sysfs_is_supported(struct libmtd *lib)
return 0;
sprintf(file, lib->mtd_name, num);
- fd = open(file, O_RDONLY);
+ fd = open(file, O_RDONLY | O_CLOEXEC);
if (fd == -1)
return 0;
@@ -1193,7 +1193,7 @@ int mtd_write_img(const struct mtd_dev_info *mtd, int fd, int eb, int offs,
return -1;
}
- in_fd = open(img_name, O_RDONLY);
+ in_fd = open(img_name, O_RDONLY | O_CLOEXEC);
if (in_fd == -1)
return sys_errmsg("cannot open \"%s\"", img_name);