From 4f2bb5ceafbc09d0c2dea4ee91ddf7d6052e65b3 Mon Sep 17 00:00:00 2001 From: Roy Marples Date: Tue, 17 Jun 2008 15:14:33 +0000 Subject: open should use 3 args when using O_CREAT. --- src/rc/checkpath.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'src/rc') diff --git a/src/rc/checkpath.c b/src/rc/checkpath.c index 765506de..8726dca8 100644 --- a/src/rc/checkpath.c +++ b/src/rc/checkpath.c @@ -57,7 +57,9 @@ static int do_check(char *path, uid_t uid, gid_t gid, mode_t mode, int file) if (stat(path, &st)) { if (file) { einfo("%s: creating file", path); - if ((fd = open(path, O_CREAT)) == -1) { + if (! mode) + mode = S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP | S_IROTH; + if ((fd = open(path, O_CREAT, mode)) == -1) { eerror("%s: open: %s", applet, strerror(errno)); return -1; } -- cgit v1.2.3