summaryrefslogtreecommitdiffstats
path: root/src/udev/udevadm-control.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/udev/udevadm-control.c')
-rw-r--r--src/udev/udevadm-control.c7
1 files changed, 3 insertions, 4 deletions
diff --git a/src/udev/udevadm-control.c b/src/udev/udevadm-control.c
index 9546a6ebaf..c704279512 100644
--- a/src/udev/udevadm-control.c
+++ b/src/udev/udevadm-control.c
@@ -137,18 +137,17 @@ static int adm_control(struct udev *udev, int argc, char *argv[]) {
break;
}
case 't': {
+ int r, seconds;
usec_t s;
- int seconds;
- int r;
r = parse_sec(optarg, &s);
if (r < 0)
return log_error_errno(r, "Failed to parse timeout value '%s'.", optarg);
- if (((s + USEC_PER_SEC - 1) / USEC_PER_SEC) > INT_MAX)
+ if (DIV_ROUND_UP(s, USEC_PER_SEC) > INT_MAX)
log_error("Timeout value is out of range.");
else {
- seconds = s != USEC_INFINITY ? (int) ((s + USEC_PER_SEC - 1) / USEC_PER_SEC) : INT_MAX;
+ seconds = s != USEC_INFINITY ? (int) DIV_ROUND_UP(s, USEC_PER_SEC) : INT_MAX;
timeout = seconds;
rc = 0;
}