]> git.ipfire.org Git - thirdparty/bird.git/commitdiff
CLI: Dumping forces new file creation instead of truncating.
authorMaria Matejka <mq@ucw.cz>
Tue, 3 Dec 2024 09:57:10 +0000 (10:57 +0100)
committerMaria Matejka <mq@ucw.cz>
Tue, 3 Dec 2024 09:57:10 +0000 (10:57 +0100)
doc/bird.sgml
sysdep/unix/io.c

index 5393edb2e248037d8038386aced493c53c20219f..5bed6df3c088cbd5d2593074aba5eef859509dab 100644 (file)
@@ -1455,11 +1455,12 @@ This argument can be omitted if there exists only a single instance.
        Control protocol debugging.
 
        <tag><label id="cli-dump">dump resources|sockets|interfaces|neighbors|attributes|routes|protocols "<m/file/"</tag>
-       Truncates the given file and dumps contents of internal data structures
-       there. By sending SIGUSR1, you get all of these concatenated to
-       <cf/bird.dump/ in the current directory. The file is only readable for
-       the user running the daemon. The format of dump files is internal and
-       could change in the future.
+        Creates the given file (it must not exist) and dumps contents of
+        internal data structures there. By sending SIGUSR1, you get all of
+       these concatenated to <cf/bird.dump/ in the current directory.
+       The file is only readable for the user running the daemon.
+       The format of dump files is internal and could change in the future
+       without any notice.
 
        <tag><label id="cli-echo">echo all|off|{ <m/list of log classes/ } [ <m/buffer-size/ ]</tag>
        Control echoing of log messages to the command-line output.
index b06324860058d2523c9c0bb87dee2c5ec0c31af9..54768d47f48bce119507e405f18aa3ac10ace407 100644 (file)
@@ -217,7 +217,7 @@ void
 dump_to_file_run(struct dump_request *dr, const char *file, const char *what, void (*dump)(struct dump_request *))
 {
   struct dump_request_file *req = SKIP_BACK(struct dump_request_file, dr, dr);
-  req->fd = open(file, O_CREAT | O_WRONLY | O_TRUNC, S_IRUSR);
+  req->fd = open(file, O_CREAT | O_WRONLY | O_EXCL, S_IRUSR);
 
   if (req->fd < 0)
   {