Skip to content

Commit

Permalink
pkcheck: do not attempt to parse /proc/PID/cmdline if pid is invalid
Browse files Browse the repository at this point in the history
Error opening `/proc/0/cmdline': Failed to open file ?/proc/0/cmdline?: No such file or directory
  • Loading branch information
bluca committed Dec 15, 2024
1 parent 2ce8ee9 commit 7bd211d
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/programs/pkcheck.c
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,8 @@ _polkit_subject_get_cmdline (PolkitSubject *subject)
}

pid = polkit_unix_process_get_pid (POLKIT_UNIX_PROCESS (process));
if (pid <= 0)
goto out;

filename = g_strdup_printf ("/proc/%d/cmdline", pid);

Expand Down

0 comments on commit 7bd211d

Please sign in to comment.