From: millert Date: Thu, 2 Jun 2022 15:35:55 +0000 (+0000) Subject: Don't treat the first arg as a 4.3BSD option string if it contains a '/'. X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=ed108a78ea1a1ef69a2672b3f5bd5aff4ff5a1cb;p=openbsd Don't treat the first arg as a 4.3BSD option string if it contains a '/'. Also document that files-to-dump could be interpreted as a 4.3BSD option if it doesn't contain a slash. OK deraadt@ --- diff --git a/sbin/dump/dump.8 b/sbin/dump/dump.8 index ebb59e4e2bd..e0ede7a50e1 100644 --- a/sbin/dump/dump.8 +++ b/sbin/dump/dump.8 @@ -1,4 +1,4 @@ -.\" $OpenBSD: dump.8,v 1.54 2019/12/19 09:38:03 bentley Exp $ +.\" $OpenBSD: dump.8,v 1.55 2022/06/02 15:35:55 millert Exp $ .\" $NetBSD: dump.8,v 1.17 1997/06/05 11:15:06 lukem Exp $ .\" .\" Copyright (c) 1980, 1991, 1993 @@ -31,7 +31,7 @@ .\" .\" @(#)dump.8 8.1 (Berkeley) 6/16/93 .\" -.Dd $Mdocdate: December 19 2019 $ +.Dd $Mdocdate: June 2 2022 $ .Dt DUMP 8 .Os .Sh NAME @@ -293,6 +293,13 @@ In the latter case, certain restrictions are placed on the backup: is ignored, the only dump level that is supported is .Fl 0 , and all of the files must reside on the same filesystem. +If no options are specified, the first of the +.Ar files-to-dump +must contain a +.Ql / +character to prevent it from being interpreted as a +.Bx 4.3 +option string. .Pp .Nm requires operator intervention on these conditions: diff --git a/sbin/dump/main.c b/sbin/dump/main.c index 0370be54883..75133ff42ca 100644 --- a/sbin/dump/main.c +++ b/sbin/dump/main.c @@ -1,4 +1,4 @@ -/* $OpenBSD: main.c,v 1.62 2021/01/21 00:16:36 mortimer Exp $ */ +/* $OpenBSD: main.c,v 1.63 2022/06/02 15:35:55 millert Exp $ */ /* $NetBSD: main.c,v 1.14 1997/06/05 11:13:24 lukem Exp $ */ /*- @@ -718,9 +718,9 @@ obsolete(int *argcp, char **argvp[]) argv = *argvp; argc = *argcp; - /* Return if no arguments or first argument has leading dash. */ + /* Return if no args or first argument has leading dash or a slash. */ ap = argv[1]; - if (argc == 1 || *ap == '-') + if (argc == 1 || *ap == '-' || strchr(ap, '/') != NULL) return; /* Allocate space for new arguments. */