X-Git-Url: http://git.archive.openwrt.org/?p=project%2Fodhcpd.git;a=blobdiff_plain;f=src%2Fdhcpv6-ia.c;fp=src%2Fdhcpv6-ia.c;h=fb50448844417311d40278a174bec0fc5115c200;hp=888634fe1f29482930afd78685d8f125ae94149d;hb=9eac2a8963415e6a74c2fc13a3c8d05cd0f81d4d;hpb=1b630f8bc59978884c9caccebca3b6d8e9b045a1 diff --git a/src/dhcpv6-ia.c b/src/dhcpv6-ia.c index 888634f..fb50448 100644 --- 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; - - 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");