ifupdown: improve compatibility with Debian
[oweals/busybox.git] / networking / tftp.c
index 17485a527ac299f3263faaebb707e06dda9fe274..ce48a1edd5f5089f5a68ea3467c9b5d8f59465c9 100644 (file)
@@ -789,8 +789,9 @@ int tftpd_main(int argc UNUSED_PARAM, char **argv)
                openlog(applet_name, LOG_PID, LOG_DAEMON);
                logmode = LOGMODE_SYSLOG;
        }
-       if (argv[0])
-               xchdir(argv[0]);
+       if (argv[0]) {
+               xchroot(argv[0]);
+       }
 
        result = recv_from_to(STDIN_FILENO, block_buf, sizeof(block_buf),
                        0 /* flags */,
@@ -813,7 +814,8 @@ int tftpd_main(int argc UNUSED_PARAM, char **argv)
                goto err;
        }
        mode = local_file + strlen(local_file) + 1;
-       if (mode >= block_buf + result || strcmp(mode, "octet") != 0) {
+       /* RFC 1350 says mode string is case independent */
+       if (mode >= block_buf + result || strcasecmp(mode, "octet") != 0) {
                goto err;
        }
 # if ENABLE_FEATURE_TFTP_BLOCKSIZE