547
547
* the Upstart instance (last part of the DBus path) in the filename.
550
/* Extract PID from UPSTART_SESSION */
551
user_session_path = nih_str_split (NULL, user_session_addr, "/", TRUE);
552
for (int i = 0; user_session_path[i] != NULL; i++)
553
path_element = user_session_path[i];
555
if (! path_element) {
556
nih_fatal (_("Invalid value for UPSTART_SESSION"));
560
pidfile_path = getenv ("XDG_RUNTIME_DIR");
562
pidfile_path = getenv ("HOME");
565
NIH_MUST (nih_strcat_sprintf (&pidfile, NULL, "%s/upstart-file-bridge.%s.pid",
566
pidfile_path, path_element));
567
nih_main_set_pidfile (pidfile);
552
/* Extract PID from UPSTART_SESSION */
553
user_session_path = nih_str_split (NULL, user_session_addr, "/", TRUE);
555
for (int i = 0; user_session_path && user_session_path[i]; i++)
556
path_element = user_session_path[i];
558
if (! path_element) {
559
nih_fatal (_("Invalid value for UPSTART_SESSION"));
563
pidfile_path = getenv ("XDG_RUNTIME_DIR");
565
pidfile_path = getenv ("HOME");
568
NIH_MUST (nih_strcat_sprintf (&pidfile, NULL, "%s/upstart-file-bridge.%s.pid",
569
pidfile_path, path_element));
570
nih_main_set_pidfile (pidfile);
570
574
if (nih_main_daemonise () < 0) {