tar: truncate existing files.
authorBrett Gordon <beretta42@gmail.com>
Sun, 8 Apr 2018 16:42:12 +0000 (12:42 -0400)
committerBrett Gordon <beretta42@gmail.com>
Sun, 8 Apr 2018 16:42:12 +0000 (12:42 -0400)
Applications/util/tar.c

index 68151dc..558d5f4 100644 (file)
@@ -576,7 +576,7 @@ static void extract(char *argv[])
                                        continue;
                                }
                                /* open output file */
-                               outfile = open(h.name, O_CREAT | O_WRONLY);
+                               outfile = open(h.name, O_CREAT | O_WRONLY | O_TRUNC);
                                if (outfile < 0) {
                                        pname();
                                        break;