* unless there is a very good reason. Most command-line options will
* get deprecated at some point. */
char *popt, opts[] =
- "H:vhkrdD:xX:m:u:4:6:I:C:p:M:P:S:iL:@ ";
+ "H:vhkrdD:p:xX:m:u:4:6:I:C:p:M:P:S:iL:@ ";
int i, found, advertise_version = 1;
#ifdef ENABLE_LLDPMED
int lldpmed = 0, noinventory = 0;
char *platform_override = NULL;
char *lsb_release = NULL;
const char *lldpcli = LLDPCLI_PATH;
+ const char *pidfile = LLDPD_PID_FILE;
int smart = 15;
int receiveonly = 0, version = 0;
int ctl;
case 'D':
log_accept(optarg);
break;
+ case 'p':
+ pidfile = optarg;
+ break;
case 'r':
receiveonly = 1;
break;
log_debug("main", "daemonize");
if (daemon(0, 0) != 0)
fatal("main", "failed to detach daemon");
- if ((pid = open(LLDPD_PID_FILE,
+ if ((pid = open(pidfile,
O_TRUNC | O_CREAT | O_WRONLY, 0666)) == -1)
- fatal("main", "unable to open pid file " LLDPD_PID_FILE);
+ fatal("main", "unable to open pid file " LLDPD_PID_FILE
+ " (or the specified one)");
if (asprintf(&spid, "%d\n", getpid()) == -1)
- fatal("main", "unable to create pid file " LLDPD_PID_FILE);
+ fatal("main", "unable to create pid file " LLDPD_PID_FILE
+ " (or the specified one)");
if (write(pid, spid, strlen(spid)) == -1)
- fatal("main", "unable to write pid file " LLDPD_PID_FILE);
+ fatal("main", "unable to write pid file " LLDPD_PID_FILE
+ " (or the specified one)");
free(spid);
close(pid);
}