Seems that we never closed the opened syslog.
Here is a patch to do this in all our binaries.
#define info(format, arg...) do { } while (0)
#define dbg(format, arg...) do { } while (0)
#define dbg_parse(format, arg...) do { } while (0)
-#define init_logging(foo) do { } while (0)
+#define logging_init(foo) do { } while (0)
+#define logging_close(foo) do { } while (0)
#ifdef LOG
#include <stdarg.h>
/* each program that uses syslog must declare this variable somewhere */
extern unsigned char logname[LOGNAME_SIZE];
-#undef init_logging
-static inline void init_logging(char *program_name)
+#undef logging_init
+static inline void logging_init(char *program_name)
{
snprintf(logname, LOGNAME_SIZE,"%s[%d]", program_name, getpid());
openlog(logname, 0, LOG_DAEMON);
}
+#undef logging_close
+static inline void logging_close(void)
+{
+ closelog();
+}
+
#endif /* LOG */
#endif
main_argv = argv;
main_envp = envp;
- init_logging("udev");
+ logging_init("udev");
udev_init_config();
udevdb_exit();
exit:
+ logging_close();
return retval;
}
/* child */
execle(udev_bin, "udev", msg->subsystem, NULL, env);
dbg("exec of child failed");
- exit(1);
+ _exit(1);
break;
case -1:
dbg("fork of child failed");
struct sigaction act;
fd_set readfds;
- init_logging("udevd");
+ logging_init("udevd");
dbg("version %s", UDEV_VERSION);
if (getuid() != 0) {
}
exit:
close(ssock);
+ logging_close();
exit(1);
}
int main(int argc, char *argv[], char *envp[])
{
- int retval;
+ int rc = 0;
main_argv = argv;
main_argc = argc;
- init_logging("udevinfo");
+ logging_init("udevinfo");
/* initialize our configuration */
udev_init_config();
- retval = process_options();
- if (retval != 0)
- exit(1);
- exit(0);
+ rc = process_options();
+
+ logging_close();
+ exit(rc);
}
socklen_t addrlen;
int started_daemon = 0;
- init_logging("udevsend");
+ logging_init("udevsend");
dbg("version %s", UDEV_VERSION);
subsystem = get_subsystem(argv[1]);
if (sock != -1)
close(sock);
+ logging_close();
+
return retval;
}
int rc = 0;
const char *error = NULL;
- init_logging("wait_for_sysfs");
+ logging_init("wait_for_sysfs");
if (argc != 2) {
dbg("error: subsystem");
dbg("result: waiting for sysfs successful '%s'", devpath);
}
+ logging_close();
exit(rc);
}