]> git.ipfire.org Git - thirdparty/libarchive.git/commitdiff
Remove extra newline from error messages (#2541)
authorTobias Stoeckmann <stoeckmann@users.noreply.github.com>
Sun, 16 Mar 2025 22:33:05 +0000 (23:33 +0100)
committerGitHub <noreply@github.com>
Sun, 16 Mar 2025 22:33:05 +0000 (15:33 -0700)
The lafe_errc function adds a newline by itself already, so do not
insert one into the message.

You can reproduce with the following commands:

```
touch archive.tar
bsdtar -xf archive.tar -C /non-existing
```

```
bsdtar --exclude ""
```

Signed-off-by: Tobias Stoeckmann <tobias@stoeckmann.org>
tar/bsdtar.c
tar/util.c

index daa24ffe51e5c2ec57ee8a7764a3f3aa54123a72..bce8344fc4a06e065d5505946ba7eca7057fa80c 100644 (file)
@@ -334,7 +334,7 @@ main(int argc, char **argv)
                        if (archive_match_exclude_pattern(
                            bsdtar->matching, bsdtar->argument) != ARCHIVE_OK)
                                lafe_errc(1, 0,
-                                   "Couldn't exclude %s\n", bsdtar->argument);
+                                   "Couldn't exclude %s", bsdtar->argument);
                        break;
                case OPTION_EXCLUDE_VCS: /* GNU tar */
                        for(t=0; vcs_files[t]; t++) {
@@ -342,7 +342,7 @@ main(int argc, char **argv)
                                    bsdtar->matching,
                                    vcs_files[t]) != ARCHIVE_OK)
                                        lafe_errc(1, 0, "Couldn't "
-                                           "exclude %s\n", vcs_files[t]);
+                                           "exclude %s", vcs_files[t]);
                        }
                        break;
                case OPTION_FFLAGS:
index f3cbdf0bb44cfd76bbd44adffebe12c7d4fc7486..e467008210ebe4c7337142643b77baabed9b3b75 100644 (file)
@@ -329,7 +329,7 @@ do_chdir(struct bsdtar *bsdtar)
                return;
 
        if (chdir(bsdtar->pending_chdir) != 0) {
-               lafe_errc(1, 0, "could not chdir to '%s'\n",
+               lafe_errc(1, 0, "could not chdir to '%s'",
                    bsdtar->pending_chdir);
        }
        free(bsdtar->pending_chdir);