continue from revision 5.10 -- if the user creates a symlink to the
authorKeith Bostic <bostic@ucbvax.Berkeley.EDU>
Wed, 1 May 1991 00:38:20 +0000 (16:38 -0800)
committerKeith Bostic <bostic@ucbvax.Berkeley.EDU>
Wed, 1 May 1991 00:38:20 +0000 (16:38 -0800)
target file, using the -s option, then can use a symlink to get to the file.
Add O_EXCL to the open of the spool file.

SCCS-vsn: usr.sbin/lpr/lpd/recvjob.c 5.13

usr/src/usr.sbin/lpr/lpd/recvjob.c

index e4c9995..7ba9a27 100644 (file)
@@ -6,7 +6,7 @@
  */
 
 #ifndef lint
  */
 
 #ifndef lint
-static char sccsid[] = "@(#)recvjob.c  5.12 (Berkeley) %G%";
+static char sccsid[] = "@(#)recvjob.c  5.13 (Berkeley) %G%";
 #endif /* not lint */
 
 /*
 #endif /* not lint */
 
 /*
@@ -199,7 +199,8 @@ readfile(file, size)
        register int i, j, amt;
        int fd, err;
 
        register int i, j, amt;
        int fd, err;
 
-       fd = open(file, O_WRONLY|O_CREAT, FILMOD);
+       fd = open(file, O_CREAT|O_EXECL|O_WRONLY, FILMOD);
+               frecverr("illegal path name");
        if (fd < 0)
                frecverr("%s: %m", file);
        ack();
        if (fd < 0)
                frecverr("%s: %m", file);
        ack();