diff options
author | Lennart Poettering <lennart@poettering.net> | 2018-03-20 20:36:09 +0100 |
---|---|---|
committer | Lennart Poettering <lennart@poettering.net> | 2018-03-20 20:59:02 +0100 |
commit | be6b0c21654e1c587cb942d464281bcc89ef4ddf (patch) | |
tree | 64ae8adf2baaabbcd146402e098c0760a0e9c7ac /src/udev | |
parent | basic/fs-util: skip fsync_directory_of_file() if /proc/self/fd/ is not availa... (diff) | |
download | systemd-be6b0c21654e1c587cb942d464281bcc89ef4ddf.tar.xz systemd-be6b0c21654e1c587cb942d464281bcc89ef4ddf.zip |
coccinelle: make use of DIV_ROUND_UP() wherever appropriate
Let's use our macros where we can
Diffstat (limited to 'src/udev')
-rw-r--r-- | src/udev/udevadm-control.c | 7 |
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; } |