summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2013-07-17 02:52:41 +0200
committerLennart Poettering <lennart@poettering.net>2013-07-17 02:52:41 +0200
commitdd94c17e7da89fa612952119ac825116dc5a8deb (patch)
tree8261f6b1833dc1547e6e825cce5bc5817c7d3e14
parent32b2634edf218e250b84615bbf106b2baf42d69b (diff)
util: make gcc shut up by passing a 0 mode param to open()
If we pass a variable to open()'s flags parameter it really wants a mode parameter too, otherwise some gcc version whine. Hence, pass 0 in that case.
-rw-r--r--src/shared/util.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/shared/util.c b/src/shared/util.c
index f56d2a2d33..5b602ea46d 100644
--- a/src/shared/util.c
+++ b/src/shared/util.c
@@ -1875,8 +1875,10 @@ int open_terminal(const char *name, int mode) {
* https://bugs.launchpad.net/ubuntu/+source/linux/+bug/554172/comments/245
*/
+ assert(!(mode & O_CREAT));
+
for (;;) {
- fd = open(name, mode);
+ fd = open(name, mode, 0);
if (fd >= 0)
break;
@@ -3520,7 +3522,9 @@ DIR *xopendirat(int fd, const char *name, int flags) {
int nfd;
DIR *d;
- nfd = openat(fd, name, O_RDONLY|O_NONBLOCK|O_DIRECTORY|O_CLOEXEC|flags);
+ assert(!(flags & O_CREAT));
+
+ nfd = openat(fd, name, O_RDONLY|O_NONBLOCK|O_DIRECTORY|O_CLOEXEC|flags, 0);
if (nfd < 0)
return NULL;