Deleted Added
full compact
tftpd.c (22989) tftpd.c (24193)
1/*
2 * Copyright (c) 1983, 1993
3 * The Regents of the University of California. All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright

--- 16 unchanged lines hidden (view full) ---

25 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
26 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
27 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
28 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
29 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
30 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
31 * SUCH DAMAGE.
32 *
1/*
2 * Copyright (c) 1983, 1993
3 * The Regents of the University of California. All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright

--- 16 unchanged lines hidden (view full) ---

25 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
26 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
27 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
28 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
29 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
30 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
31 * SUCH DAMAGE.
32 *
33 * $Id$
33 * $Id: tftpd.c,v 1.7 1997/02/22 14:22:36 peter Exp $
34 */
35
36#ifndef lint
37static char copyright[] =
38"@(#) Copyright (c) 1983, 1993\n\
39 The Regents of the University of California. All rights reserved.\n";
40#endif /* not lint */
41

--- 375 unchanged lines hidden (view full) ---

417
418 /*
419 * If the file exists in one of the directories and isn't
420 * readable, continue looking. However, change the error code
421 * to give an indication that the file exists.
422 */
423 err = ENOTFOUND;
424 for (dirp = dirs; dirp->name != NULL; dirp++) {
34 */
35
36#ifndef lint
37static char copyright[] =
38"@(#) Copyright (c) 1983, 1993\n\
39 The Regents of the University of California. All rights reserved.\n";
40#endif /* not lint */
41

--- 375 unchanged lines hidden (view full) ---

417
418 /*
419 * If the file exists in one of the directories and isn't
420 * readable, continue looking. However, change the error code
421 * to give an indication that the file exists.
422 */
423 err = ENOTFOUND;
424 for (dirp = dirs; dirp->name != NULL; dirp++) {
425 sprintf(pathname, "%s/%s", dirp->name, filename);
425 snprintf(pathname, sizeof(pathname), "%s/%s",
426 dirp->name, filename);
426 if (stat(pathname, &stbuf) == 0 &&
427 (stbuf.st_mode & S_IFMT) == S_IFREG) {
428 if ((stbuf.st_mode & S_IROTH) != 0) {
429 break;
430 }
431 err = EACCESS;
432 }
433 }

--- 193 unchanged lines hidden (view full) ---

627{
628 static char buf[20];
629 register struct errmsg *pe;
630 if (error == 0)
631 return "success";
632 for (pe = errmsgs; pe->e_code >= 0; pe++)
633 if (pe->e_code == error)
634 return pe->e_msg;
427 if (stat(pathname, &stbuf) == 0 &&
428 (stbuf.st_mode & S_IFMT) == S_IFREG) {
429 if ((stbuf.st_mode & S_IROTH) != 0) {
430 break;
431 }
432 err = EACCESS;
433 }
434 }

--- 193 unchanged lines hidden (view full) ---

628{
629 static char buf[20];
630 register struct errmsg *pe;
631 if (error == 0)
632 return "success";
633 for (pe = errmsgs; pe->e_code >= 0; pe++)
634 if (pe->e_code == error)
635 return pe->e_msg;
635 sprintf(buf, "error %d", error);
636 snprintf(buf, sizeof(buf), "error %d", error);
636 return buf;
637}
638
639/*
640 * Send a nak packet (error message).
641 * Error code passed in is one of the
642 * standard TFTP codes, or a UNIX errno
643 * offset by 100.

--- 40 unchanged lines hidden ---
637 return buf;
638}
639
640/*
641 * Send a nak packet (error message).
642 * Error code passed in is one of the
643 * standard TFTP codes, or a UNIX errno
644 * offset by 100.

--- 40 unchanged lines hidden ---