From 90f5f3552c89d2cf7b8e09dc072860da9859062a Mon Sep 17 00:00:00 2001 From: Lennart Poettering Date: Fri, 24 Mar 2023 18:27:03 +0100 Subject: [PATCH] import: use truncate_nl() where appropriate --- src/import/importd.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/import/importd.c b/src/import/importd.c index 4675aa5a612..a58587beb26 100644 --- a/src/import/importd.c +++ b/src/import/importd.c @@ -554,9 +554,9 @@ static int manager_on_notify(sd_event_source *s, int fd, uint32_t revents, void }; struct ucred *ucred; Manager *m = userdata; - char *p, *e; Transfer *t; ssize_t n; + char *p; int r; n = recvmsg_safe(fd, &msghdr, MSG_DONTWAIT|MSG_CMSG_CLOEXEC); @@ -594,8 +594,7 @@ static int manager_on_notify(sd_event_source *s, int fd, uint32_t revents, void if (!p) return 0; - e = strchrnul(p, '\n'); - *e = 0; + truncate_nl(p); r = parse_percent(p); if (r < 0) { -- 2.47.3