From: Vincent Bernat Date: Wed, 19 Nov 2008 19:01:48 +0000 (+0100) Subject: Fix open() calls X-Git-Tag: 0.2.1~1 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=0aa5f6766136c696b8297676917bdce1365f9892;p=thirdparty%2Flldpd.git Fix open() calls --- diff --git a/src/lldpd.c b/src/lldpd.c index 57aaa527..07ecbfd8 100644 --- a/src/lldpd.c +++ b/src/lldpd.c @@ -1354,7 +1354,7 @@ main(int argc, char *argv[]) if (daemon(0, 0) != 0) fatal("failed to detach daemon"); if ((pid = open(LLDPD_PID_FILE, - O_TRUNC | O_CREAT | O_WRONLY)) == -1) + O_TRUNC | O_CREAT | O_WRONLY, 0644)) == -1) fatal("unable to open pid file " LLDPD_PID_FILE); if (asprintf(&spid, "%d\n", getpid()) == -1) fatal("unable to create pid file " LLDPD_PID_FILE); diff --git a/src/priv.c b/src/priv.c index b85f2947..8935934a 100644 --- a/src/priv.c +++ b/src/priv.c @@ -278,7 +278,7 @@ asroot_open() free(file); return; } - if ((fd = open(file, 0)) == -1) { + if ((fd = open(file, O_RDONLY)) == -1) { rc = -1; must_write(remote, &rc, sizeof(int)); free(file);