Skip to content

Commit ca70447

Browse files
committed
Recording the launched program PID into a file thanks to the pid script
1 parent a4bbf06 commit ca70447

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

opkrun.c

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -455,15 +455,14 @@ int main(int argc, char **argv)
455455
execvp(args[0], args);
456456
}
457457

458-
FILE *fp = fopen("/var/run/funkey.pid", "w");
459-
if (fp != NULL) {
460-
fprintf(fp, "%d\n", son);
461-
fclose(fp);
462-
}
458+
/* Record the PID into a file */
459+
sprintf(command, "pid record %d", son);
460+
system(command);
463461

464462
/* Wait for son pid to finish */
465463
int status;
466464
waitpid(son, &status, 0);
465+
system("pid erase");
467466

468467
/* Move back to / folder */
469468
chdir("/");

0 commit comments

Comments
 (0)