projects
/
project
/
odhcp6c.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
518cdfc
)
Cleanup pidfile-gerneration
author
Steven Barth
<steven@midlink.org>
Fri, 28 Nov 2014 09:20:35 +0000
(10:20 +0100)
committer
Steven Barth
<steven@midlink.org>
Fri, 28 Nov 2014 09:20:35 +0000
(10:20 +0100)
src/odhcp6c.c
patch
|
blob
|
history
diff --git
a/src/odhcp6c.c
b/src/odhcp6c.c
index 89dfd369588842fd647288598d0648d6a71e8f0d..8149738ade5d6d84cc88d7c14c55a8639236c232 100644
(file)
--- a/
src/odhcp6c.c
+++ b/
src/odhcp6c.c
@@
-254,19
+254,15
@@
int main(_unused int argc, char* const argv[])
return 4;
}
return 4;
}
- char pidbuf[128];
if (!pidfile) {
if (!pidfile) {
- snprintf(pidbuf, sizeof(pidbuf),
- "/var/run/odhcp6c.%s.pid", ifname);
- pidfile = pidbuf;
+ snprintf((char*)buf, sizeof(buf), "/var/run/odhcp6c.%s.pid", ifname);
+ pidfile = (char*)buf;
}
}
- int fd = open(pidfile, O_WRONLY | O_CREAT, 0644);
- if (fd >= 0) {
- char buf[8];
- int len = snprintf(buf, sizeof(buf), "%i\n", getpid());
- write(fd, buf, len);
- close(fd);
+ FILE *fp = fopen(pidfile, "w");
+ if (fp) {
+ fprintf(fp, "%i\n", getpid());
+ fclose(fp);
}
}
}
}