[systemd-commits] 2 commits - src/shared units/getty at .service.m4 units/serial-getty at .service.m4

Michal Schmidt michich at kemper.freedesktop.org
Mon Oct 29 15:00:01 PDT 2012


 src/shared/util.c              |    5 ++---
 units/getty at .service.m4        |    3 +--
 units/serial-getty at .service.m4 |    3 +--
 3 files changed, 4 insertions(+), 7 deletions(-)

New commits:
commit 2161de72c517d34d1ceb9b4c1a300f0b54ce5a9c
Author: Michal Schmidt <mschmidt at redhat.com>
Date:   Mon Oct 29 21:59:34 2012 +0100

    units: agetty overrides TERM
    
    Environment=TERM=... has no effect on agetty who sets it by itself. To
    really set TERM to a specified value, it has to be given on the command
    line.
    
    https://bugzilla.redhat.com/show_bug.cgi?id=870622

diff --git a/units/getty at .service.m4 b/units/getty at .service.m4
index b5875ce..810c23f 100644
--- a/units/getty at .service.m4
+++ b/units/getty at .service.m4
@@ -43,9 +43,8 @@ IgnoreOnIsolate=yes
 ConditionPathExists=/dev/tty0
 
 [Service]
-Environment=TERM=linux
 # the VT is cleared by TTYVTDisallocate
-ExecStart=-/sbin/agetty --noclear %I 38400
+ExecStart=-/sbin/agetty --noclear %I 38400 linux
 Type=idle
 Restart=always
 RestartSec=0
diff --git a/units/serial-getty at .service.m4 b/units/serial-getty at .service.m4
index a6bbd71..c411dc1 100644
--- a/units/serial-getty at .service.m4
+++ b/units/serial-getty at .service.m4
@@ -39,8 +39,7 @@ Before=getty.target
 IgnoreOnIsolate=yes
 
 [Service]
-Environment=TERM=vt102
-ExecStart=-/sbin/agetty -s %I 115200,38400,9600
+ExecStart=-/sbin/agetty -s %I 115200,38400,9600 vt102
 Type=idle
 Restart=always
 RestartSec=0

commit fd09c93de9337c3df566180d04368353bb3662e7
Author: Michal Schmidt <mschmidt at redhat.com>
Date:   Mon Oct 29 21:04:47 2012 +0100

    util: improve overflow checks
    
    commit 49371bb fixed the observed division by zero, but missed another
    occurrence of the same bug. It was also not the optimal fix. We can
    simply make the divisor a constant by swapping it with the compared
    value.

diff --git a/src/shared/util.c b/src/shared/util.c
index 9a45e60..8ec83e4 100644
--- a/src/shared/util.c
+++ b/src/shared/util.c
@@ -148,8 +148,7 @@ usec_t timespec_load(const struct timespec *ts) {
             ts->tv_nsec == (long) -1)
                 return (usec_t) -1;
 
-        if (ts->tv_sec > 0 &&
-            USEC_PER_SEC > ((UINT64_MAX - (ts->tv_nsec / NSEC_PER_USEC)) / (usec_t) ts->tv_sec))
+        if ((usec_t) ts->tv_sec > (UINT64_MAX - (ts->tv_nsec / NSEC_PER_USEC)) / USEC_PER_SEC)
                 return (usec_t) -1;
 
         return
@@ -179,7 +178,7 @@ usec_t timeval_load(const struct timeval *tv) {
             tv->tv_usec == (suseconds_t) -1)
                 return (usec_t) -1;
 
-        if (USEC_PER_SEC > (UINT64_MAX - tv->tv_usec) / (usec_t) tv->tv_sec)
+        if ((usec_t) tv->tv_sec > (UINT64_MAX - tv->tv_usec) / USEC_PER_SEC)
                 return (usec_t) -1;
 
         return



More information about the systemd-commits mailing list