From nobody Tue Nov 19 09:29:32 2024 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4Xszj86tJRz5dpmt; Tue, 19 Nov 2024 09:29:32 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Xszj83FsGz4bv5; Tue, 19 Nov 2024 09:29:32 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1732008572; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=DZ++YxgZrOPBKK1uxDKlCjxyaWc4aeRvEWm650/Qdrs=; b=L2wW/w3S6I+1MQrIKnSwlPCrm5eiA/4aZLW8MRrjCTXuDQw0C1HlwtYwTUiBiMGtiRUSCG JBUQkBZ7EyBBUc7EyiWBK86IgKKEGSXQ1bHB0AmBDS4y6F5UEh0NWa4kMxgLbCsk4U0lm6 RITzGQGTj8S5y5k3b9oRtPjP85yhWsngxXq0CKA+SOwDuxdwekx+X2VGro5fCCyyk36k8M uRpIIR+GdgNk4YUyyvA1CNCpFV8tyWwOx+73ukOG58t+LCtU4+oSCm8kZQS96jGgb04oG0 lxz3qrFdiFiLpUj/qcAG8/jsd3CmYSRmuYlWTl+CIm3fbciDACCfw7jDgKaDCQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1732008572; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=DZ++YxgZrOPBKK1uxDKlCjxyaWc4aeRvEWm650/Qdrs=; b=hemRTVf477PHRxtl/MnefVnOkvhJqFiiAU99vpbIwa8vvQhjitxiK+u/NY20BBIAaTwHWq Zk4wXinWXO5pcAzpAFboiToVdzd4f0327f9GYT2aVHF5OGkbP6Axk4T0L7Hu4il7Jm7jEj li/xhSNgH+lhsYGH+mUIwyVm5G9rRckrnCmo4LEMBfLK5D037WCHEAijggcWqeoNOuNQci roillV6LsR+fHPfZwOLsjkfW4A0hxvqGV+ezGasNG31pMxi4wOwizeD2wckFj48jQQXWf+ h4z3e86jNX6MdjNc9YhiB4UcCNWgjAjje+HwtnryGq7PbDFGCGSYDwWtxg5xWQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1732008572; a=rsa-sha256; cv=none; b=fLq5sEYt88tjDoLMd0puS8Acjz2iE+EwdWZHEZsLs6O5kHZDdKRvZfolgjqfHJpe/uj5ba kOu9c0aUH7hCtSYn3PInMm+pseOV8IMpkc9sQ59ConQEUsZP32fnsOnARBwKjdGmOZAzDM fvP6XDC06PV0b0iGZnq1ha63/Bv2k+r5JnZosMsiI//FmW59hhnDx4zpyymAJo9ZQx8QYX w1+J0PepqBFiYS4lLW1dAypsPUupg2V2K2Tb8Jc+ITZ12sjQl42UERnKslX7atxJSMI0CJ LbE6+pH1WP64+Ah8Pud1eZrMHI2SGbMgIt90pJg/Rcdkcm0oVXQpWzyA5/u9aA== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4Xszj82q8Gz1JdC; Tue, 19 Nov 2024 09:29:32 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 4AJ9TWls070430; Tue, 19 Nov 2024 09:29:32 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 4AJ9TWeT070427; Tue, 19 Nov 2024 09:29:32 GMT (envelope-from git) Date: Tue, 19 Nov 2024 09:29:32 GMT Message-Id: <202411190929.4AJ9TWeT070427@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Dag-Erling =?utf-8?Q?Sm=C3=B8rgrav?= Subject: git: dc6105ebedcf - main - mv: More style nits. List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-dev-commits-src-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: des X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: dc6105ebedcf762d0c6b42785bb2a914f8ade12c Auto-Submitted: auto-generated The branch main has been updated by des: URL: https://cgit.FreeBSD.org/src/commit/?id=dc6105ebedcf762d0c6b42785bb2a914f8ade12c commit dc6105ebedcf762d0c6b42785bb2a914f8ade12c Author: Dag-Erling Smørgrav AuthorDate: 2024-11-19 09:29:05 +0000 Commit: Dag-Erling Smørgrav CommitDate: 2024-11-19 09:29:05 +0000 mv: More style nits. Sponsored by: Klara, Inc. Reviewed by: markj Differential Revision: https://reviews.freebsd.org/D47568 --- bin/mv/mv.c | 37 +++++++++++++++---------------------- 1 file changed, 15 insertions(+), 22 deletions(-) diff --git a/bin/mv/mv.c b/bin/mv/mv.c index c3080112cee5..801ac52dc31e 100644 --- a/bin/mv/mv.c +++ b/bin/mv/mv.c @@ -32,13 +32,12 @@ * SUCH DAMAGE. */ -#include -#include #include +#include +#include +#include #include #include -#include -#include #include #include @@ -62,18 +61,16 @@ static int copy(const char *, const char *); static int do_move(const char *, const char *); static int fastcopy(const char *, const char *, struct stat *); static void usage(void); -static void preserve_fd_acls(int source_fd, int dest_fd, const char *source_path, - const char *dest_path); +static void preserve_fd_acls(int, int, const char *, const char *); int main(int argc, char *argv[]) { - size_t baselen, len; - int rval; - char *p, *endp; - struct stat sb; - int ch; char path[PATH_MAX]; + struct stat sb; + char *p, *endp; + size_t baselen, len; + int ch, rval; while ((ch = getopt(argc, argv, "fhinv")) != -1) switch (ch) { @@ -161,9 +158,10 @@ main(int argc, char *argv[]) static int do_move(const char *from, const char *to) { + char path[PATH_MAX], modep[15]; + struct statfs sfs; struct stat sb; int ask, ch, first; - char modep[15]; /* * Check access. If interactive and file exists, ask user if it @@ -171,9 +169,8 @@ do_move(const char *from, const char *to) * make sure the user wants to clobber it. */ if (!fflg && !access(to, F_OK)) { - /* prompt only if source exists */ - if (lstat(from, &sb) == -1) { + if (lstat(from, &sb) == -1) { warn("%s", from); return (1); } @@ -217,9 +214,6 @@ do_move(const char *from, const char *to) } if (errno == EXDEV) { - struct statfs sfs; - char path[PATH_MAX]; - /* * If the source is a symbolic link and is on another * filesystem, it can be recreated at the destination. @@ -305,8 +299,8 @@ err: if (unlink(to)) warn("%s: set owner/group (was: %lu/%lu)", to, (u_long)sbp->st_uid, (u_long)sbp->st_gid); if (oldmode & (S_ISUID | S_ISGID)) { - warnx( -"%s: owner/group changed; clearing suid/sgid (mode was 0%03o)", + warnx("%s: owner/group changed; " + "clearing suid/sgid (mode was 0%03o)", to, oldmode); sbp->st_mode &= ~(S_ISUID | S_ISGID); } @@ -494,9 +488,8 @@ preserve_fd_acls(int source_fd, int dest_fd, const char *source_path, static void usage(void) { - (void)fprintf(stderr, "%s\n%s\n", - "usage: mv [-f | -i | -n] [-hv] source target", - " mv [-f | -i | -n] [-v] source ... directory"); + "usage: mv [-f | -i | -n] [-hv] source target", + " mv [-f | -i | -n] [-v] source ... directory"); exit(EX_USAGE); }