From: Lennart Poettering Date: Fri, 24 Mar 2023 17:27:03 +0000 (+0100) Subject: import: use truncate_nl() where appropriate X-Git-Tag: v254-rc1~929^2 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=refs%2Fpull%2F26977%2Fhead;p=thirdparty%2Fsystemd.git import: use truncate_nl() where appropriate --- 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) {