diff --git a/timeoutd.c b/timeoutd.c index ce9f598..cacb21a 100644 --- a/timeoutd.c +++ b/timeoutd.c @@ -68,7 +68,7 @@ #define SESSMAX 3 #define DAYMAX 4 #define NOLOGIN 5 -/*#define XSESSION 6*/ + #define IDLEMSG 0 #define SESSMSG 1 #define DAYMSG 2 @@ -324,7 +324,6 @@ void read_wtmp() wtmplist = ut_list_p; } - /* Position the file pointer 2 structures back */ if (fseek(fp, -2 * sizeof(struct utmp), SEEK_CUR) < 0) break; } @@ -569,7 +568,7 @@ void read_config() config[i]->warntime), i++; } printf("End debug output.\n"); -#endif /* DEBUG */ +#endif } char chktimes(te) @@ -905,8 +904,8 @@ void check_idle() } void bailout(message, status) /* display error message and exit */ -int status; /* exit status */ -char *message; /* pointer to the error message */ +int status; +char *message; { syslog(LOG_ERR, "Exiting - %s", message); exit(status); @@ -1122,10 +1121,10 @@ char *dev, *host; return 1; } else return 0; -} /* chk_xterm(dev,host) */ +} -void killit_xsession(pid, user, host) /* returns 1 when host seems to be a xSession. */ +void killit_xsession(pid, user, host) int pid; char *host, *user; { @@ -1225,7 +1224,6 @@ char *display; #endif /*change into the user running x. we need that to connect to X */ - /*setregid(1000, 1000); We don't need this */ /*save old, to come back */ oldeuid = geteuid(); @@ -1240,7 +1238,7 @@ char *display; putenv(homedir); /* First, check if there is a xserver.. */ - if ((dpy = XOpenDisplay(display)) == NULL) { /* = intended */ + if ((dpy = XOpenDisplay(display)) == NULL) { syslog(LOG_NOTICE, "Could not connect to %s to query idle-time for %s. Ignoring.", display, user); } else { @@ -1255,7 +1253,7 @@ char *display; setuid(oldeuid); return retval; -} /* get_xidle(user) */ +} #endif @@ -1279,7 +1277,7 @@ pid_t ppid; proc = opendir("/proc/"); if (proc == NULL) { printf("error opening directory\n"); - return -1; /* error */ + return -1; } while ((cont = readdir(proc)) != NULL) { @@ -1293,9 +1291,9 @@ pid_t ppid; fgets(akt_pid, 10, proc_file); if (atoi(akt_pid) == ppid) - return (pid_t) atoi(cont->d_name); /* return pid of child */ + return (pid_t) atoi(cont->d_name); } } return 0; /* no child found */ -} /* getchild(ppid) */ +}