From 1ee1505a38134f46de2dc671f34a69298bfd3300 Mon Sep 17 00:00:00 2001 From: Dominique Martinet Date: Thu, 3 Aug 2023 16:37:27 +0900 Subject: [PATCH] try to create rundir if missing Runtime dir changed from /run to /run/pppd in commit 66a8c74c3f73 ("Let ./configure control the paths for pppd") and is likely to not exist on some distros, in which case the pppdb will not be created. See: #419 (lock directory moved in ppp-2.5.0) Signed-off-by: Dominique Martinet --- pppd/tdb.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/pppd/tdb.c b/pppd/tdb.c index 8a563f88b..cf3190f13 100644 --- a/pppd/tdb.c +++ b/pppd/tdb.c @@ -1728,7 +1728,12 @@ TDB_CONTEXT *tdb_open_ex(const char *name, int hash_size, int tdb_flags, goto internal; } +again: if ((tdb->fd = open(name, open_flags, mode)) == -1) { + if ((open_flags & O_CREAT) && errno == ENOENT && + mkdir_recursive(PPP_PATH_VARRUN) == 0) + goto again; + TDB_LOG((tdb, 5, "tdb_open_ex: could not open file %s: %s\n", name, strerror(errno))); goto fail; /* errno set by open(2) */