[systemd-commits] 2 commits - configure.ac src/util.c

Lennart Poettering lennart at kemper.freedesktop.org
Fri Feb 10 15:28:43 PST 2012


 configure.ac |   17 ++++++++++++-----
 src/util.c   |   17 ++++++++++++-----
 2 files changed, 24 insertions(+), 10 deletions(-)

New commits:
commit bc9bdbbab45ea2c10fdd8ad7c517b5e4a358bdfb
Author: Michał Górny <mgorny at gentoo.org>
Date:   Fri Feb 10 12:10:41 2012 +0100

    build-sys: Support explicitly specifying --enable-split-usr.
    
    Fixes: https://bugs.freedesktop.org/show_bug.cgi?id=45875

diff --git a/configure.ac b/configure.ac
index a41cf41..1506382 100644
--- a/configure.ac
+++ b/configure.ac
@@ -605,11 +605,18 @@ AC_ARG_WITH([pamlibdir],
         [],
         [with_pamlibdir=${with_rootlibdir}/security])
 
-have_split_usr=no
-if test "x${ac_default_prefix}" != "x${with_rootprefix}" ; then
+AC_ARG_ENABLE([split-usr],
+        AS_HELP_STRING([--enable-split-usr], [Assume that /bin, /sbin aren\'t symlinks into /usr]),
+        [],
+        [AS_IF([test "x${ac_default_prefix}" != "x${with_rootprefix}"], [
+                enable_split_usr=yes
+        ], [
+                enable_split_usr=no
+        ])])
+
+AS_IF([test "x${enable_split_usr}" = "xyes"], [
         AC_DEFINE(HAVE_SPLIT_USR, 1, [Define if /bin, /sbin aren't symlinks into /usr])
-        have_split_usr=yes
-fi
+])
 
 AC_SUBST([dbuspolicydir], [$with_dbuspolicydir])
 AC_SUBST([dbussessionservicedir], [$with_dbussessionservicedir])
@@ -659,6 +666,6 @@ AC_MSG_RESULT([
         D-Bus session dir:       ${with_dbussessionservicedir}
         D-Bus system dir:        ${with_dbussystemservicedir}
         D-Bus interfaces dir:    ${with_dbusinterfacedir}
-        Split /usr:              ${have_split_usr}
+        Split /usr:              ${enable_split_usr}
         Build man pages:         ${have_manpages}
 ])

commit 4099a281bb1e7bbb941c55de559dbfb9abf5897b
Author: Lennart Poettering <lennart at poettering.net>
Date:   Sat Feb 11 00:27:12 2012 +0100

    util: fix handling of empty files in read_one_line_file()
    
    https://bugs.freedesktop.org/show_bug.cgi?id=45362

diff --git a/src/util.c b/src/util.c
index 11f77ab..3329922 100644
--- a/src/util.c
+++ b/src/util.c
@@ -705,15 +705,22 @@ int read_one_line_file(const char *fn, char **line) {
         assert(fn);
         assert(line);
 
-        if (!(f = fopen(fn, "re")))
+        f = fopen(fn, "re");
+        if (!f)
                 return -errno;
 
-        if (!(fgets(t, sizeof(t), f))) {
-                r = feof(f) ? -EIO : -errno;
-                goto finish;
+        if (!fgets(t, sizeof(t), f)) {
+
+                if (ferror(f)) {
+                        r = -errno;
+                        goto finish;
+                }
+
+                t[0] = 0;
         }
 
-        if (!(c = strdup(t))) {
+        c = strdup(t);
+        if (!c) {
                 r = -ENOMEM;
                 goto finish;
         }



More information about the systemd-commits mailing list