summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 3779c8e)
raw | patch | inline | side by side (parent: 3779c8e)
author | Mike Frysinger <vapier@gentoo.org> | |
Sat, 10 Nov 2012 19:47:46 +0000 (19:47 +0000) | ||
committer | Tom Rini <trini@ti.com> | |
Wed, 19 Dec 2012 22:51:57 +0000 (15:51 -0700) |
When using open(), the O_CREAT flag must be given a mode, otherwise it
uses random garbage from the stack. Also, it can fail to build:
In file included from /usr/include/fcntl.h:290:0,
from fw_env_main.c:42:
In function 'open',
inlined from 'main' at fw_env_main.c:97:9:
/usr/include/bits/fcntl2.h:50:24: error: call to '__open_missing_mode' declared
with attribute error: open with O_CREAT in second argument needs 3 arguments
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
Acked-by: Joe Hershberger <joe.hershberger@ni.com>
uses random garbage from the stack. Also, it can fail to build:
In file included from /usr/include/fcntl.h:290:0,
from fw_env_main.c:42:
In function 'open',
inlined from 'main' at fw_env_main.c:97:9:
/usr/include/bits/fcntl2.h:50:24: error: call to '__open_missing_mode' declared
with attribute error: open with O_CREAT in second argument needs 3 arguments
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
Acked-by: Joe Hershberger <joe.hershberger@ni.com>
tools/env/fw_env_main.c | patch | blob | history |
index c855f4c17eb82767a67719ec4314e261bede3a6a..40ea3f62a28a54aa683cb15da571a94cc396e224 100644 (file)
--- a/tools/env/fw_env_main.c
+++ b/tools/env/fw_env_main.c
int lockfd = -1;
int retval = EXIT_SUCCESS;
- lockfd = open(lockname, O_WRONLY | O_CREAT | O_TRUNC);
+ lockfd = open(lockname, O_WRONLY | O_CREAT | O_TRUNC, 0666);
if (-1 == lockfd) {
fprintf(stderr, "Error opening lock file %s\n", lockname);
return EXIT_FAILURE;