]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
import: use truncate_nl() where appropriate 26977/head
authorLennart Poettering <lennart@poettering.net>
Fri, 24 Mar 2023 17:27:03 +0000 (18:27 +0100)
committerLennart Poettering <lennart@poettering.net>
Fri, 24 Mar 2023 17:33:59 +0000 (18:33 +0100)
src/import/importd.c

index 4675aa5a6120ac74f4c3f374158bfc2a902ae952..a58587beb26fd4fdf04fd115232b154fb24b926d 100644 (file)
@@ -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) {