X-Git-Url: https://git.ozlabs.org/?a=blobdiff_plain;f=pppd%2Fmain.c;h=652240cc6868bf13b4404be886beff2231263cd0;hb=57edb1a0ebf3e25d824b22c75d1d95e0f378f74a;hp=41be5328d4b8d7b7af89935cc66f093a5b932da9;hpb=7f2f0deae2e0055373ccdd995cd3027aca546549;p=ppp.git diff --git a/pppd/main.c b/pppd/main.c index 41be532..652240c 100644 --- a/pppd/main.c +++ b/pppd/main.c @@ -737,12 +737,16 @@ void set_ifunit(iskey) int iskey; { + char ifkey[32]; + if (req_ifname[0] != '\0') slprintf(ifname, sizeof(ifname), "%s", req_ifname); else slprintf(ifname, sizeof(ifname), "%s%d", PPP_DRV_NAME, ifunit); info("Using interface %s", ifname); script_setenv("IFNAME", ifname, iskey); + slprintf(ifkey, sizeof(ifkey), "%d", ifunit); + script_setenv("UNIT", ifkey, iskey); if (iskey) { create_pidfile(getpid()); /* write pid to file */ create_linkpidfile(getpid()); @@ -1574,7 +1578,8 @@ safe_fork(int infd, int outfd, int errfd) /* Executing in the child */ sys_close(); #ifdef USE_TDB - tdb_close(pppdb); + if (pppdb != NULL) + tdb_close(pppdb); #endif /* make sure infd, outfd and errfd won't get tromped on below */