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);
_______________________________________________
[email protected] mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "[email protected]"

Reply via email to