diff options
| author | Roy Marples <roy@marples.name> | 2009-07-08 19:22:31 +0000 |
|---|---|---|
| committer | Roy Marples <roy@marples.name> | 2009-07-08 19:22:31 +0000 |
| commit | 735e9a2062586257dabe0b5620a734ee8c47732e (patch) | |
| tree | d3a2b1b6d1f5fc2ca62e791c928884f07a1db2e7 | |
| parent | 975b7b49bb65b6a50d4e6dbe951bec831fc91d6b (diff) | |
| download | dhcpcd-735e9a2062586257dabe0b5620a734ee8c47732e.tar.xz | |
Ensure that DBDIR and RUNDIR exist if defined as /var/db/dhcpcd and/or /var/run/dhcpcd.
| -rw-r--r-- | dhcpcd.c | 10 |
1 files changed, 10 insertions, 0 deletions
@@ -1677,6 +1677,16 @@ main(int argc, char **argv) exit(EXIT_FAILURE); } + /* Ensure we have the needed directories */ + if (mkdir(RUNDIR, 0755) == -1 && errno != EEXIST) { + syslog(LOG_ERR, "mkdir `%s': %m", RUNDIR); + exit(EXIT_FAILURE); + } + if (mkdir(DBDIR, 0755) == -1 && errno != EEXIST) { + syslog(LOG_ERR, "mkdir `%s': %m", DBDIR); + exit(EXIT_FAILURE); + } + pidfd = open(pidfile, O_WRONLY | O_CREAT | O_NONBLOCK, 0664); if (pidfd == -1) { syslog(LOG_ERR, "open `%s': %m", pidfile); |
