Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 10 Mar 2023 13:29:19 GMT
From:      =?utf-8?Q?Dag-Erling=20Sm=C3=B8rgrav?= <des@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org
Subject:   git: 9f6f64941c02 - main - tftpd: Make the -d option behave as documented.
Message-ID:  <202303101329.32ADTJvg090104@gitrepo.freebsd.org>

next in thread | raw e-mail | index | archive | help
The branch main has been updated by des:

URL: https://cgit.FreeBSD.org/src/commit/?id=9f6f64941c02596b01367fd99abdd2c91ba0fe79

commit 9f6f64941c02596b01367fd99abdd2c91ba0fe79
Author:     Dag-Erling Smørgrav <des@FreeBSD.org>
AuthorDate: 2023-03-10 13:24:32 +0000
Commit:     Dag-Erling Smørgrav <des@FreeBSD.org>
CommitDate: 2023-03-10 13:25:16 +0000

    tftpd: Make the -d option behave as documented.
    
    Sponsored by:   Klara, Inc.
    Reviewed by:    markj
    Differential Revision:  https://reviews.freebsd.org/D38965
---
 libexec/tftpd/tftpd.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/libexec/tftpd/tftpd.c b/libexec/tftpd/tftpd.c
index c592a592bf7f..4b8a3024fe5a 100644
--- a/libexec/tftpd/tftpd.c
+++ b/libexec/tftpd/tftpd.c
@@ -140,7 +140,7 @@ main(int argc, char *argv[])
 	acting_as_client = 0;
 
 	tftp_openlog("tftpd", LOG_PID | LOG_NDELAY, LOG_FTP);
-	while ((ch = getopt(argc, argv, "cCd:F:lnoOp:s:u:U:wW")) != -1) {
+	while ((ch = getopt(argc, argv, "cCd::F:lnoOp:s:u:U:wW")) != -1) {
 		switch (ch) {
 		case 'c':
 			ipchroot = 1;
@@ -149,7 +149,9 @@ main(int argc, char *argv[])
 			ipchroot = 2;
 			break;
 		case 'd':
-			if (atoi(optarg) != 0)
+			if (optarg == NULL)
+				debug++;
+			else if (atoi(optarg) != 0)
 				debug += atoi(optarg);
 			else
 				debug |= debug_finds(optarg);



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202303101329.32ADTJvg090104>