]> git.ipfire.org Git - thirdparty/lldpd.git/commitdiff
Fix open() calls
authorVincent Bernat <bernat@luffy.cx>
Wed, 19 Nov 2008 19:01:48 +0000 (20:01 +0100)
committerVincent Bernat <bernat@luffy.cx>
Wed, 19 Nov 2008 19:01:48 +0000 (20:01 +0100)
src/lldpd.c
src/priv.c

index 57aaa52713d8950b8d342bc24412db0274708f7d..07ecbfd8c3c235c386aac1e7bd6a983fa2ac16a8 100644 (file)
@@ -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);
index b85f29476ad972e0028da916b2e68606e308e9f2..8935934a7a407c4a5f820afc9b25ffef92dd7d96 100644 (file)
@@ -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);