mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2025-12-31 10:10:14 +01:00
utils: use stack allocated buffer for path in nm_utils_get_start_time_for_pid()
This commit is contained in:
parent
1178f814a1
commit
0fbe055e2a
1 changed files with 2 additions and 2 deletions
|
|
@ -482,7 +482,7 @@ guint64
|
|||
nm_utils_get_start_time_for_pid (pid_t pid, char *out_state, pid_t *out_ppid)
|
||||
{
|
||||
guint64 start_time;
|
||||
gs_free gchar *filename = NULL;
|
||||
char filename[256];
|
||||
gs_free gchar *contents = NULL;
|
||||
size_t length;
|
||||
gs_strfreev gchar **tokens = NULL;
|
||||
|
|
@ -497,7 +497,7 @@ nm_utils_get_start_time_for_pid (pid_t pid, char *out_state, pid_t *out_ppid)
|
|||
|
||||
g_return_val_if_fail (pid > 0, 0);
|
||||
|
||||
filename = g_strdup_printf ("/proc/%"G_GUINT64_FORMAT"/stat", (guint64) pid);
|
||||
nm_sprintf_buf (filename, "/proc/%"G_GUINT64_FORMAT"/stat", (guint64) pid);
|
||||
|
||||
if (!g_file_get_contents (filename, &contents, &length, NULL))
|
||||
goto out;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue