]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
sd-journal: use -EBADF for invalidated file descriptor
authorYu Watanabe <watanabe.yu+github@gmail.com>
Thu, 21 Aug 2025 20:02:52 +0000 (05:02 +0900)
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Wed, 12 Nov 2025 14:18:40 +0000 (15:18 +0100)
src/libsystemd/sd-journal/sd-journal.c

index 840f6d684b44cd9edd48b9bb36699dcbaeda16e9..195fdb72f217b8250299770341c4befd19cb1800 100644 (file)
@@ -1740,7 +1740,7 @@ static int add_file_by_name(
         if (!path)
                 return -ENOMEM;
 
-        return add_any_file(j, -1, path);
+        return add_any_file(j, /* fd = */ -EBADF, path);
 }
 
 static int remove_file_by_name(
@@ -2427,7 +2427,7 @@ _public_ int sd_journal_open_files(sd_journal **ret, const char **paths, int fla
                 return -ENOMEM;
 
         STRV_FOREACH(path, paths) {
-                r = add_any_file(j, -1, *path);
+                r = add_any_file(j, /* fd = */ -EBADF, *path);
                 if (r < 0)
                         return r;
         }
@@ -2514,7 +2514,7 @@ _public_ int sd_journal_open_files_fd(sd_journal **ret, int fds[], unsigned n_fd
                 if (r < 0)
                         goto fail;
 
-                r = add_any_file(j, fds[i], NULL);
+                r = add_any_file(j, fds[i], /* path = */ NULL);
                 if (r < 0)
                         goto fail;
         }