This is an automated email from the git hooks/post-receive script.

guillem pushed a commit to branch master
in repository dpkg.

View the commit online:
https://git.dpkg.org/cgit/dpkg/dpkg.git/commit/?id=aa9159778d46bff55bcdb7501d280766a5f556a0

commit aa9159778d46bff55bcdb7501d280766a5f556a0
Author: Guillem Jover <[email protected]>
AuthorDate: Sat Jun 27 16:05:18 2020 +0200

    u-a: Move log_msg() after make_path()
    
    This way we can use the latter.
---
 debian/changelog            |  3 +++
 utils/update-alternatives.c | 52 ++++++++++++++++++++++-----------------------
 2 files changed, 29 insertions(+), 26 deletions(-)

diff --git a/debian/changelog b/debian/changelog
index f3d0250a3..3d9526164 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -4,6 +4,9 @@ dpkg (1.20.2) UNRELEASED; urgency=medium
   * update-alternatives: Create alternatives directory (/etc/alternatives)
     if it is missing, to help with installation bootstrapping.
     Reported by Johannes Schauer <[email protected]>.
+  * Code internals:
+    - update-alternatives: Move log_msg() after make_path() so that we can use
+      the latter.
   * Build system:
     - Set SHELL in the test environment.
     - Do not fail if po4a is not found, and search for it just once.
diff --git a/utils/update-alternatives.c b/utils/update-alternatives.c
index 9b26552d2..d4c8909cd 100644
--- a/utils/update-alternatives.c
+++ b/utils/update-alternatives.c
@@ -291,32 +291,6 @@ pr(char const *fmt, ...)
        printf("\n");
 }
 
-static void DPKG_ATTR_PRINTF(1)
-log_msg(const char *fmt, ...)
-{
-       va_list args;
-
-       if (fh_log == NULL) {
-               fh_log = fopen(log_file, "a");
-               if (fh_log == NULL && errno != EACCES)
-                       syserr(_("cannot append to '%s'"), log_file);
-       }
-
-       if (fh_log) {
-               char timestamp[64];
-               time_t now;
-
-               time(&now);
-               strftime(timestamp, sizeof(timestamp), "%Y-%m-%d %H:%M:%S",
-                        localtime(&now));
-               fprintf(fh_log, "%s %s: ", PROGNAME, timestamp);
-               va_start(args, fmt);
-               vfprintf(fh_log, fmt, args);
-               va_end(args);
-               fprintf(fh_log, "\n");
-       }
-}
-
 static void *
 xmalloc(size_t size)
 {
@@ -492,6 +466,32 @@ make_path(const char *pathname, mode_t mode)
        return 0;
 }
 
+static void DPKG_ATTR_PRINTF(1)
+log_msg(const char *fmt, ...)
+{
+       va_list args;
+
+       if (fh_log == NULL) {
+               fh_log = fopen(log_file, "a");
+               if (fh_log == NULL && errno != EACCES)
+                       syserr(_("cannot append to '%s'"), log_file);
+       }
+
+       if (fh_log) {
+               char timestamp[64];
+               time_t now;
+
+               time(&now);
+               strftime(timestamp, sizeof(timestamp), "%Y-%m-%d %H:%M:%S",
+                        localtime(&now));
+               fprintf(fh_log, "%s %s: ", PROGNAME, timestamp);
+               va_start(args, fmt);
+               vfprintf(fh_log, fmt, args);
+               va_end(args);
+               fprintf(fh_log, "\n");
+       }
+}
+
 /*
  * Filesystem access for alernative handling.
  */

-- 
Dpkg.Org's dpkg

Reply via email to