[openssh-commits] [openssh] 02/04: upstream: remove '?' from getopt(3) loops

git+noreply at mindrot.org git+noreply at mindrot.org
Fri Dec 9 11:36:58 AEDT 2022


This is an automated email from the git hooks/post-receive script.

dtucker pushed a commit to branch master
in repository openssh.

commit b85c3581c16aaf6e83b9a797c80705a56b1f312e
Author: cheloha at openbsd.org <cheloha at openbsd.org>
Date:   Sun Dec 4 23:50:49 2022 +0000

    upstream: remove '?' from getopt(3) loops
    
    userspace: remove vestigial '?' cases from top-level getopt(3) loops
    
    getopt(3) returns '?' when it encounters a flag not present in the in
    the optstring or if a flag is missing its option argument.  We can
    handle this case with the "default" failure case with no loss of
    legibility.  Hence, remove all the redundant "case '?':" lines.
    
    Prompted by dlg at .  With help from dlg@ and millert at .
    
    Link: https://marc.info/?l=openbsd-tech&m=167011979726449&w=2
    
    ok naddy@ millert@ dlg@
    
    OpenBSD-Commit-ID: b2f89346538ce4f5b33ab8011a23e0626a67e66e
---
 ssh-keygen.c  | 3 +--
 ssh-keyscan.c | 3 +--
 sshd.c        | 3 +--
 3 files changed, 3 insertions(+), 6 deletions(-)

diff --git a/ssh-keygen.c b/ssh-keygen.c
index 5469037a..ae05440f 100644
--- a/ssh-keygen.c
+++ b/ssh-keygen.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ssh-keygen.c,v 1.460 2022/11/07 04:04:40 djm Exp $ */
+/* $OpenBSD: ssh-keygen.c,v 1.461 2022/12/04 23:50:49 cheloha Exp $ */
 /*
  * Author: Tatu Ylonen <ylo at cs.hut.fi>
  * Copyright (c) 1994 Tatu Ylonen <ylo at cs.hut.fi>, Espoo, Finland
@@ -3544,7 +3544,6 @@ main(int argc, char **argv)
 			else
 				fatal("Unsupported moduli option %s", optarg);
 			break;
-		case '?':
 		default:
 			usage();
 		}
diff --git a/ssh-keyscan.c b/ssh-keyscan.c
index a8ab932b..0d91df5c 100644
--- a/ssh-keyscan.c
+++ b/ssh-keyscan.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ssh-keyscan.c,v 1.147 2022/10/28 02:29:34 djm Exp $ */
+/* $OpenBSD: ssh-keyscan.c,v 1.148 2022/12/04 23:50:49 cheloha Exp $ */
 /*
  * Copyright 1995, 1996 by David Mazieres <dm at lcs.mit.edu>.
  *
@@ -807,7 +807,6 @@ main(int argc, char **argv)
 		case '6':
 			IPv4or6 = AF_INET6;
 			break;
-		case '?':
 		default:
 			usage();
 		}
diff --git a/sshd.c b/sshd.c
index d5e6a133..6bb3a962 100644
--- a/sshd.c
+++ b/sshd.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: sshd.c,v 1.592 2022/10/28 00:44:17 djm Exp $ */
+/* $OpenBSD: sshd.c,v 1.593 2022/12/04 23:50:49 cheloha Exp $ */
 /*
  * Author: Tatu Ylonen <ylo at cs.hut.fi>
  * Copyright (c) 1995 Tatu Ylonen <ylo at cs.hut.fi>, Espoo, Finland
@@ -1678,7 +1678,6 @@ main(int ac, char **av)
 				exit(1);
 			free(line);
 			break;
-		case '?':
 		default:
 			usage();
 			break;

-- 
To stop receiving notification emails like this one, please contact
djm at mindrot.org.


More information about the openssh-commits mailing list