diff options
author | Christian Hesse <mail@eworm.de> | 2014-05-06 15:32:00 +0200 |
---|---|---|
committer | Christian Hesse <mail@eworm.de> | 2014-05-06 15:32:00 +0200 |
commit | 9dd762b29b0cf54638ae88cf17a7d2c559cc9614 (patch) | |
tree | 720c64ae5c14c04fc1e4670c621cdb2eadb2082b | |
parent | 70f1aa530fd7953c66248a4002d5ba42f5f5e6e9 (diff) | |
download | dyndhcpd-9dd762b29b0cf54638ae88cf17a7d2c559cc9614.tar.gz dyndhcpd-9dd762b29b0cf54638ae88cf17a7d2c559cc9614.tar.zst |
check existence of leaes file
-rw-r--r-- | dyndhcpd.c | 4 |
1 files changed, 4 insertions, 0 deletions
@@ -262,6 +262,10 @@ int main(int argc, char ** argv) { leasesfile = malloc(strlen(LEASESFILE) + strlen(interface) + 1); sprintf(leasesfile, LEASESFILE, interface); + /* check if leases file exists, create it if it does not */ + if (access(leasesfile, R_OK) == -1) + fclose(fopen(leasesfile, "w")); + /* execute dhcp daemon, replace the current process * dyndhcpd is cleared from memory here and code below is not execuded if * everything goes well */ |