diff options
author | Eion Robb <eion@robbmob.com> | 2008-01-29 15:34:10 +0300 |
---|---|---|
committer | Eion Robb <eion@robbmob.com> | 2008-01-29 15:34:10 +0300 |
commit | b028de68c8ede5b1c7f019b0e21ce7ff39994655 (patch) | |
tree | 5d40541a92d286c916ab23372ca249b0b11778b9 /skype_messaging_x11.c | |
parent | 73c829d8b40b86c0b828e0d043f16d520c229fd1 (diff) |
remove compiler warnings and stat function name clashes
Diffstat (limited to 'skype_messaging_x11.c')
-rw-r--r-- | skype_messaging_x11.c | 17 |
1 files changed, 10 insertions, 7 deletions
diff --git a/skype_messaging_x11.c b/skype_messaging_x11.c index 26b6725..9e158cd 100644 --- a/skype_messaging_x11.c +++ b/skype_messaging_x11.c @@ -223,20 +223,21 @@ exec_skype() purple_debug_error("skype", "Could not start skype: %s\n", error->message); return FALSE; }
-}
+} +
static gboolean is_skype_running() { - gchar *temp; + const gchar *temp; int pid; gchar* stat_path; FILE *fh; gchar exec_name[15]; - struct stat *stat; + struct stat *statobj = NULL; //open /proc GDir *procdir = g_dir_open("/proc", 0, NULL); //go through directories that are numbers - while(temp = g_dir_read_name(procdir)) + while((temp = g_dir_read_name(procdir))) { pid = atoi(temp); if (!pid) @@ -245,7 +246,7 @@ is_skype_running() stat_path = g_strdup_printf("/proc/%d/stat", pid); fh = fopen(stat_path, "r"); // fscanf (file, "%*d (%15[^)]" - fscanf(fh, "%*d (%15[^)]", &exec_name); + pid = fscanf(fh, "%*d (%15[^)]", exec_name); fclose(fh); if (strcmp(exec_name, "skype") != 0) { @@ -253,14 +254,16 @@ is_skype_running() continue; } //get uid/owner of stat file by using fstat() - g_stat(stat_path, stat); + g_stat(stat_path, statobj); g_free(stat_path); //compare uid/owner of stat file (in g_stat->st_uid) to getuid(); - if (stat->st_uid == getuid()) + if (statobj->st_uid == getuid()) { //this copy of skype was started by us return TRUE; } } g_dir_close(procdir); + return FALSE; } + |