projects
/
project
/
odhcpd.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
dhcpv6-ia: Check lockf return value
[project/odhcpd.git]
/
src
/
dhcpv6-ia.c
diff --git
a/src/dhcpv6-ia.c
b/src/dhcpv6-ia.c
index
888634f
..
fb50448
100644
(file)
--- a/
src/dhcpv6-ia.c
+++ b/
src/dhcpv6-ia.c
@@
-242,8
+242,12
@@
void dhcpv6_write_statefile(void)
int fd = open(config.dhcp_statefile, O_CREAT | O_WRONLY | O_CLOEXEC, 0644);
if (fd < 0)
return;
int fd = open(config.dhcp_statefile, O_CREAT | O_WRONLY | O_CLOEXEC, 0644);
if (fd < 0)
return;
-
- lockf(fd, F_LOCK, 0);
+ int ret;
+ ret = lockf(fd, F_LOCK, 0);
+ if (ret < 0) {
+ close(fd);
+ return;
+ }
if (ftruncate(fd, 0) < 0) {}
FILE *fp = fdopen(fd, "w");
if (ftruncate(fd, 0) < 0) {}
FILE *fp = fdopen(fd, "w");