summaryrefslogtreecommitdiff
path: root/daemon
diff options
context:
space:
mode:
authorGeorge Lebl <jirka@5z.com>2002-07-30 18:51:31 +0000
committerGeorge Lebl <jirka@src.gnome.org>2002-07-30 18:51:31 +0000
commitfe60718fee3fbfdfd746cdfea7babdf3155e1240 (patch)
tree6cecb97b2d3f3736831ed3202af11b90fe3fbf60 /daemon
parent24d291166c1e9698899088b045245c6792e370df (diff)
downloadgdm-fe60718fee3fbfdfd746cdfea7babdf3155e1240.tar.gz
fix the linux-only proccess detection thing to work on non-linux systems
Tue Jul 30 12:00:28 2002 George Lebl <jirka@5z.com> * daemon/gdm.c: fix the linux-only proccess detection thing to work on non-linux systems correctly (logic was reversed). Properly cast when printing to the pid file (being anal). Close the pid file before failing. Don't print out the SYSLOG 'handling message' debug thing as it just clutters debug info.
Diffstat (limited to 'daemon')
-rw-r--r--daemon/gdm.c19
1 files changed, 12 insertions, 7 deletions
diff --git a/daemon/gdm.c b/daemon/gdm.c
index ac8c717a..23eaf9cc 100644
--- a/daemon/gdm.c
+++ b/daemon/gdm.c
@@ -711,8 +711,8 @@ gdm_daemonify (void)
pid = fork ();
if (pid > 0) {
- if ((pf = fopen (GdmPidFile, "w"))) {
- fprintf (pf, "%d\n", pid);
+ if ((pf = fopen (GdmPidFile, "w")) != NULL) {
+ fprintf (pf, "%d\n", (int)pid);
fclose (pf);
}
@@ -1352,13 +1352,13 @@ linux_only_is_running (pid_t pid)
if (realpath ("/proc/self/exe", resolved_self) == NULL) {
g_free (running);
/* probably not a linux system */
- return FALSE;
+ return TRUE;
}
if (realpath (running, resolved_running) == NULL) {
g_free (running);
/* probably not a linux system */
- return FALSE;
+ return TRUE;
}
g_free (running);
@@ -1455,6 +1455,7 @@ main (int argc, char *argv[])
linux_only_is_running (pidv)) {
/* make sure the pid file doesn't get wiped */
GdmPidFile = NULL;
+ fclose (pf);
gdm_fail (_("gdm already running. Aborting!"));
}
@@ -1466,8 +1467,8 @@ main (int argc, char *argv[])
if (no_daemon || getppid() == 1) {
/* Write pid to pidfile */
- if ((pf = fopen (GdmPidFile, "w"))) {
- fprintf (pf, "%d\n", getpid());
+ if ((pf = fopen (GdmPidFile, "w")) != NULL) {
+ fprintf (pf, "%d\n", (int)getpid());
fclose (pf);
}
}
@@ -1644,7 +1645,11 @@ gdm_handle_message (GdmConnection *conn, const char *msg, gpointer data)
/* cut off most of the cookie for "security" */
gdm_debug ("Handling message: '%s...'", s);
g_free (s);
- } else {
+ } else if (strncmp (msg, GDM_SOP_SYSLOG " ",
+ strlen (GDM_SOP_SYSLOG " ")) != 0) {
+ /* Don't print out the syslog message as it will
+ * be printed out anyway as that's the whole point
+ * of the message. */
gdm_debug ("Handling message: '%s'", msg);
}
}