OpenSDE Packages Database (without history before r20070)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

76 lines
2.3 KiB

  1. # --- SDE-COPYRIGHT-NOTE-BEGIN ---
  2. # This copyright note is auto-generated by ./scripts/Create-CopyPatch.
  3. #
  4. # Filename: package/.../ulogd2/0001-replace-syslog_dummy.patch
  5. # Copyright (C) 2013 The OpenSDE Project
  6. #
  7. # More information can be found in the files COPYING and README.
  8. #
  9. # This patch file is dual-licensed. It is available under the license the
  10. # patched project is licensed under, as long as it is an OpenSource license
  11. # as defined at http://www.opensource.org/ (e.g. BSD, X11) or under the terms
  12. # of the GNU General Public License as published by the Free Software
  13. # Foundation; either version 2 of the License, or (at your option) any later
  14. # version.
  15. # --- SDE-COPYRIGHT-NOTE-END ---
  16. Do not use the FILE struct as marker to check if the user requested to use
  17. syslog.
  18. In musl the FILE struct is opaque, thus its storage size is not known to
  19. the application.
  20. This means that when using musl it has to be use as a pointer like it was
  21. intended to be used.
  22. --- a/src/ulogd.c 2013-11-18 23:34:03.060775245 +0100
  23. +++ b/src/ulogd.c 2013-12-15 14:04:09.354676690 +0100
  24. @@ -83,7 +83,7 @@
  25. static const char *ulogd_configfile = ULOGD_CONFIGFILE;
  26. static const char *ulogd_pidfile = NULL;
  27. static int ulogd_pidfile_fd = -1;
  28. -static FILE syslog_dummy;
  29. +static int use_syslog;
  30. static int info_mode = 0;
  31. @@ -427,7 +427,7 @@
  32. if (level < loglevel_ce.u.value)
  33. return;
  34. - if (logfile == &syslog_dummy) {
  35. + if (use_syslog) {
  36. /* FIXME: this omits the 'file' string */
  37. va_start(ap, format);
  38. vsyslog(ulogd2syslog_level(level), format, ap);
  39. @@ -946,11 +946,12 @@
  40. ulogd_logfile = strdup(name);
  41. }
  42. + use_syslog = 0;
  43. if (!strcmp(name, "stdout")) {
  44. logfile = stdout;
  45. } else if (!strcmp(name, "syslog")) {
  46. openlog("ulogd", LOG_PID, LOG_DAEMON);
  47. - logfile = &syslog_dummy;
  48. + use_syslog = 1;
  49. } else {
  50. logfile = fopen(ulogd_logfile, "a");
  51. if (!logfile) {
  52. @@ -1240,7 +1241,7 @@
  53. unload_plugins();
  54. #endif
  55. - if (logfile != NULL && logfile != stdout && logfile != &syslog_dummy) {
  56. + if (logfile != NULL && logfile != stdout) {
  57. fclose(logfile);
  58. logfile = NULL;
  59. }
  60. @@ -1262,7 +1263,7 @@
  61. switch (signal) {
  62. case SIGHUP:
  63. /* reopen logfile */
  64. - if (logfile != stdout && logfile != &syslog_dummy) {
  65. + if (logfile != stdout && !use_syslog) {
  66. fclose(logfile);
  67. logfile = fopen(ulogd_logfile, "a");
  68. if (!logfile) {