Skip to content

Commit 209ed7f

Browse files
committed
save pid of launched executable in pid file
Signed-off-by: Michel-FK <[email protected]>
1 parent 3c918c8 commit 209ed7f

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

opkrun.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -422,6 +422,12 @@ int main(int argc, char **argv)
422422
execvp(args[0], args);
423423
}
424424

425+
FILE *fd = fopen("/var/run/funkey.pid", "w");
426+
if (fd != NULL) {
427+
fprintf(fd, "%d\n", son);
428+
fclose(fd);
429+
}
430+
425431
int status;
426432
waitpid(son, &status, 0);
427433

0 commit comments

Comments
 (0)