Commit c372969e authored by David Zeuthen's avatar David Zeuthen
Browse files

use kit_strsplit in polkit-sysdeps

parent 09a434c7
...@@ -273,7 +273,6 @@ kit_strsplit (const char *s, char delim, size_t *num_tokens) ...@@ -273,7 +273,6 @@ kit_strsplit (const char *s, char delim, size_t *num_tokens)
m++; m++;
result[n] = kit_strndup (s + begin, m - begin); result[n] = kit_strndup (s + begin, m - begin);
kit_debug ("'%s'", result[n]);
if (result[n] == NULL) if (result[n] == NULL)
goto oom; goto oom;
......
...@@ -38,8 +38,6 @@ ...@@ -38,8 +38,6 @@
#include <sys/inotify.h> #include <sys/inotify.h>
#include <syslog.h> #include <syslog.h>
#include <glib.h>
#include "polkit-sysdeps.h" #include "polkit-sysdeps.h"
#include "polkit-private.h" #include "polkit-private.h"
...@@ -73,6 +71,7 @@ polkit_sysdeps_get_start_time_for_pid (pid_t pid) ...@@ -73,6 +71,7 @@ polkit_sysdeps_get_start_time_for_pid (pid_t pid)
size_t length; size_t length;
polkit_uint64_t start_time; polkit_uint64_t start_time;
char **tokens; char **tokens;
size_t num_tokens;
char *p; char *p;
char *endp; char *endp;
...@@ -101,8 +100,11 @@ polkit_sysdeps_get_start_time_for_pid (pid_t pid) ...@@ -101,8 +100,11 @@ polkit_sysdeps_get_start_time_for_pid (pid_t pid)
goto out; goto out;
} }
tokens = g_strsplit (p, " ", 0); tokens = kit_strsplit (p, ' ', &num_tokens);
if (g_strv_length (tokens) < 20) { if (tokens == NULL)
goto out;
if (num_tokens < 20) {
goto out; goto out;
} }
...@@ -111,7 +113,7 @@ polkit_sysdeps_get_start_time_for_pid (pid_t pid) ...@@ -111,7 +113,7 @@ polkit_sysdeps_get_start_time_for_pid (pid_t pid)
goto out; goto out;
} }
g_strfreev (tokens); kit_strfreev (tokens);
out: out:
kit_free (filename); kit_free (filename);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment