Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/external/bsd/cron/dist even more detailed logging



details:   https://anonhg.NetBSD.org/src/rev/4d45aa826665
branches:  trunk
changeset: 330099:4d45aa826665
user:      christos <christos%NetBSD.org@localhost>
date:      Mon Jun 23 01:00:48 2014 +0000

description:
even more detailed logging

diffstat:

 external/bsd/cron/dist/do_command.c |  30 +++++++++++++++---------------
 1 files changed, 15 insertions(+), 15 deletions(-)

diffs (73 lines):

diff -r c3230a99d92e -r 4d45aa826665 external/bsd/cron/dist/do_command.c
--- a/external/bsd/cron/dist/do_command.c       Sun Jun 22 23:53:16 2014 +0000
+++ b/external/bsd/cron/dist/do_command.c       Mon Jun 23 01:00:48 2014 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: do_command.c,v 1.4 2014/06/21 04:33:53 dholland Exp $  */
+/*     $NetBSD: do_command.c,v 1.5 2014/06/23 01:00:48 christos Exp $  */
 
 /* Copyright 1988,1990,1993,1994 by Paul Vixie
  * All rights reserved
@@ -25,7 +25,7 @@
 #if 0
 static char rcsid[] = "Id: do_command.c,v 1.9 2004/01/23 18:56:42 vixie Exp";
 #else
-__RCSID("$NetBSD: do_command.c,v 1.4 2014/06/21 04:33:53 dholland Exp $");
+__RCSID("$NetBSD: do_command.c,v 1.5 2014/06/23 01:00:48 christos Exp $");
 #endif
 #endif
 
@@ -71,7 +71,7 @@
 child_process(entry *e) {
        int stdin_pipe[2], stdout_pipe[2];
        char * volatile input_data;
-       char *usernm, * volatile mailto;
+       char *homedir, *usernm, * volatile mailto;
        int children = 0;
 
        Debug(DPROC, ("[%ld] child_process('%s')\n", (long)getpid(), e->cmd));
@@ -243,33 +243,33 @@
                }
 #else
                if (setgid(e->pwd->pw_gid) != 0) {
-                       syslog(LOG_ERR, "setgid failed for %s",
-                              e->pwd->pw_name);
+                       syslog(LOG_ERR, "setgid(%d) failed for %s: %m",
+                           e->pwd->pw_gid, e->pwd->pw_name);
                        _exit(ERROR_EXIT);
                }
                if (initgroups(usernm, e->pwd->pw_gid) != 0) {
-                       syslog(LOG_ERR, "initgroups failed for %s",
-                              e->pwd->pw_name);
+                       syslog(LOG_ERR, "initgroups(%s, %d) failed for %s: %m",
+                           usernm, e->pwd->pw_gid, e->pwd->pw_name);
                        _exit(ERROR_EXIT);
                }
 #if (defined(BSD)) && (BSD >= 199103)
                if (setlogin(usernm) < 0) {
-                       syslog(LOG_ERR, "setlogin() failure for %s: %m",
-                              e->pwd->pw_name);
+                       syslog(LOG_ERR, "setlogin(%s) failure for %s: %m",
+                           usernm, e->pwd->pw_name);
                        _exit(ERROR_EXIT);
                }
 #endif /* BSD */
                if (setuid(e->pwd->pw_uid) != 0) {
-                       syslog(LOG_ERR, "setuid failed for %s",
-                              e->pwd->pw_name);
+                       syslog(LOG_ERR, "setuid(%d) failed for %s: %m",
+                           e->pwd->pw_uid, e->pwd->pw_name);
                        _exit(ERROR_EXIT);
                }
                /* we aren't root after this... */
 #endif /* LOGIN_CAP */
-
-               if (chdir(env_get("HOME", e->envp)) != 0) {
-                       syslog(LOG_ERR, "chdir $HOME failed for %s",
-                              e->pwd->pw_name);
+               homedir = env_get("HOME", e->envp);
+               if (chdir(homedir) != 0) {
+                       syslog(LOG_ERR, "chdir(%s) $HOME failed for %s: %m",
+                           homedir, e->pwd->pw_name);
                        _exit(ERROR_EXIT);
                }
 



Home | Main Index | Thread Index | Old Index