svn commit: r366239 - stable/12/libexec/tftpd

Mark Johnston markj at FreeBSD.org
Tue Sep 29 01:54:05 UTC 2020


Author: markj
Date: Tue Sep 29 01:54:04 2020
New Revision: 366239
URL: https://svnweb.freebsd.org/changeset/base/366239

Log:
  MFC r366002:
  tftpd: Check for errors from chdir()

Modified:
  stable/12/libexec/tftpd/tftpd.c
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/libexec/tftpd/tftpd.c
==============================================================================
--- stable/12/libexec/tftpd/tftpd.c	Tue Sep 29 01:52:53 2020	(r366238)
+++ stable/12/libexec/tftpd/tftpd.c	Tue Sep 29 01:54:04 2020	(r366239)
@@ -373,7 +373,10 @@ main(int argc, char *argv[])
 			    chroot_dir, strerror(errno));
 			exit(1);
 		}
-		chdir("/");
+		if (chdir("/") != 0) {
+			tftp_log(LOG_ERR, "chdir: %s", strerror(errno));
+			exit(1);
+		}
 		if (setgroups(1, &nobody->pw_gid) != 0) {
 			tftp_log(LOG_ERR, "setgroups failed");
 			exit(1);


More information about the svn-src-all mailing list