]> git.ozlabs.org Git - ppp.git/commitdiff
pppd: Make pid directory before creating the pid file (#536)
authorDragonBluep <70847398+DragonBluep@users.noreply.github.com>
Tue, 26 Nov 2024 09:14:42 +0000 (17:14 +0800)
committerGitHub <noreply@github.com>
Tue, 26 Nov 2024 09:14:42 +0000 (20:14 +1100)
If multilink feature is not enabled, the '/var/run/pppd' directory
won't be created before adding pid file.

Fixes error message:
'Failed to create pid file /var/run/pppd/pppoe-wan.pid: No such file or directory'

Signed-off-by: Shiji Yang <yangshiji66@outlook.com>
pppd/main.c

index 66db6a98fcc90036b36b0b266e2ba623dda1f170..a4bc777675cae86779f5638b33a373ed2a47fb08 100644 (file)
@@ -923,6 +923,7 @@ create_pidfile(int pid)
 {
     FILE *pidfile;
 
+    mkdir_recursive(PPP_PATH_VARRUN);
     slprintf(pidfilename, sizeof(pidfilename), "%s/%s.pid",
             PPP_PATH_VARRUN, ifname);
     if ((pidfile = fopen(pidfilename, "w")) != NULL) {