summaryrefslogtreecommitdiffstats
path: root/src/udev/udevadm-monitor.c
diff options
context:
space:
mode:
authorJohn Paul Adrian Glaubitz <glaubitz@physik.fu-berlin.de>2017-03-22 21:40:51 +0100
committerJohn Paul Adrian Glaubitz <glaubitz@physik.fu-berlin.de>2017-05-19 14:23:32 +0200
commitcc9211b030c1fa7dd8d0e14df1de3e2aba32e50c (patch)
tree4c0b702508dcef02e15e977f3b9ca555297b4131 /src/udev/udevadm-monitor.c
parentjournal/journald-console: fix format-specifier issue (diff)
downloadsystemd-cc9211b030c1fa7dd8d0e14df1de3e2aba32e50c.tar.xz
systemd-cc9211b030c1fa7dd8d0e14df1de3e2aba32e50c.zip
udev/udevadm-monitor: fix format-specifier issue
timespec::tv_nsec can have different sizes depending on the host architecture. On x32 in particular, it is 8 bytes long while the long int type is only 4 bytes long. Hence, using ld as a format specifier will trigger a format error. Thus, explicitly cast timespec::tv_nsec to nsec_t and use PRI_NSEC as the format specifier to make sure the sizes for both match.
Diffstat (limited to 'src/udev/udevadm-monitor.c')
-rw-r--r--src/udev/udevadm-monitor.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/udev/udevadm-monitor.c b/src/udev/udevadm-monitor.c
index f631834341..94a59186ed 100644
--- a/src/udev/udevadm-monitor.c
+++ b/src/udev/udevadm-monitor.c
@@ -41,9 +41,9 @@ static void print_device(struct udev_device *device, const char *source, int pro
struct timespec ts;
assert_se(clock_gettime(CLOCK_MONOTONIC, &ts) == 0);
- printf("%-6s[%"PRI_TIME".%06ld] %-8s %s (%s)\n",
+ printf("%-6s[%"PRI_TIME".%06"PRI_NSEC"] %-8s %s (%s)\n",
source,
- ts.tv_sec, ts.tv_nsec/1000,
+ ts.tv_sec, (nsec_t)ts.tv_nsec/1000,
udev_device_get_action(device),
udev_device_get_devpath(device),
udev_device_get_subsystem(device));