[systemd-commits] 2 commits - src/sysusers src/test

Thomas H.P. Andersen phomes at kemper.freedesktop.org
Mon Aug 4 14:28:08 PDT 2014


 src/sysusers/sysusers.c |    2 +-
 src/test/test-util.c    |    9 +++++----
 2 files changed, 6 insertions(+), 5 deletions(-)

New commits:
commit 24fb7c1fa633e90e4297e0715546c0bc47118ba9
Author: Thomas Hindoe Paaboel Andersen <phomes at gmail.com>
Date:   Mon Aug 4 23:21:06 2014 +0200

    sysusers: isempty will never be < 0
    
    looks like a typo from 	1b99214789101976d6bbf75c351279584b071998

diff --git a/src/sysusers/sysusers.c b/src/sysusers/sysusers.c
index 19568ad..446b36e 100644
--- a/src/sysusers/sysusers.c
+++ b/src/sysusers/sysusers.c
@@ -1078,7 +1078,7 @@ static bool valid_user_group_name(const char *u) {
         const char *i;
         long sz;
 
-        if (isempty(u) < 0)
+        if (isempty(u))
                 return false;
 
         if (!(u[0] >= 'a' && u[0] <= 'z') &&

commit 8e211000025940b770794abf5754de61b4add0af
Author: Thomas Hindoe Paaboel Andersen <phomes at gmail.com>
Date:   Mon Aug 4 23:13:31 2014 +0200

    test: use fabs on doubles

diff --git a/src/test/test-util.c b/src/test/test-util.c
index 470475a..16f89b4 100644
--- a/src/test/test-util.c
+++ b/src/test/test-util.c
@@ -26,6 +26,7 @@
 #include <locale.h>
 #include <errno.h>
 #include <signal.h>
+#include <math.h>
 
 #include "util.h"
 #include "mkdir.h"
@@ -191,7 +192,7 @@ static void test_safe_atod(void) {
 
         r = safe_atod("0.2244", &d);
         assert_se(r == 0);
-        assert_se(abs(d - 0.2244) < 0.000001);
+        assert_se(fabs(d - 0.2244) < 0.000001);
 
         r = safe_atod("0,5", &d);
         assert_se(r == -EINVAL);
@@ -205,20 +206,20 @@ static void test_safe_atod(void) {
 
         r = safe_atod("0.2244", &d);
         assert_se(r == 0);
-        assert_se(abs(d - 0.2244) < 0.000001);
+        assert_se(fabs(d - 0.2244) < 0.000001);
 
         r = safe_atod("0,5", &d);
         assert_se(r == -EINVAL);
 
         errno = 0;
-        assert_se(abs(strtod("0,5", &e) - 0.5) < 0.00001);
+        assert_se(fabs(strtod("0,5", &e) - 0.5) < 0.00001);
 
         /* And check again, reset */
         setlocale(LC_NUMERIC, "C");
 
         r = safe_atod("0.2244", &d);
         assert_se(r == 0);
-        assert_se(abs(d - 0.2244) < 0.000001);
+        assert_se(fabs(d - 0.2244) < 0.000001);
 
         r = safe_atod("0,5", &d);
         assert_se(r == -EINVAL);



More information about the systemd-commits mailing list