[1553] in NetBSD-Development

home help back first fref pref prev next nref lref last post

lpr bug

daemon@ATHENA.MIT.EDU (Salvatore Valente)
Tue Jan 20 17:30:35 1998

Date: Tue, 20 Jan 1998 17:30:24 -0500 (EST)
To: source-reviewers@MIT.EDU
Cc: netbsd-dev@MIT.EDU
From: Salvatore Valente <svalente@MIT.EDU>


[Cc'd to netbsd-dev because it addresses a bug mentioned in Snork's motd.]

Hello.

The change to netsend.c is necessary because sizeof(stb.st_size) is
not necessarily sizeof(int), but sprintf() has no way of knowing the
actual size of the argument.

The change to posix.h is common sense.

Have a nice day,
Sal.

Index: netsend.c
===================================================================
RCS file: /afs/dev/project/sipb/repository/athena/bin/lpr/netsend.c,v
retrieving revision 1.1.1.1
diff -c -r1.1.1.1 netsend.c
*** netsend.c	1997/12/09 21:21:07	1.1.1.1
--- netsend.c	1998/01/20 22:19:14
***************
*** 164,170 ****
  
  	if (stat(file, &stb) < 0 || (f = open(file, O_RDONLY)) < 0)
  		return(ERROR);
! 	(void) sprintf(buf, "%c%d %s\n", type, stb.st_size, file);
  	amt = strlen(buf);
  	for (i = 0;  ; i++) {
  		if (write(pfd, buf, amt) != amt ||
--- 164,170 ----
  
  	if (stat(file, &stb) < 0 || (f = open(file, O_RDONLY)) < 0)
  		return(ERROR);
! 	(void) sprintf(buf, "%c%d %s\n", type, (int)stb.st_size, file);
  	amt = strlen(buf);
  	for (i = 0;  ; i++) {
  		if (write(pfd, buf, amt) != amt ||
Index: posix.h
===================================================================
RCS file: /afs/dev/project/sipb/repository/athena/bin/lpr/posix.h,v
retrieving revision 1.1.1.1
diff -c -r1.1.1.1 posix.h
*** posix.h	1997/12/09 21:21:07	1.1.1.1
--- posix.h	1998/01/20 22:22:25
***************
*** 2,7 ****
--- 2,9 ----
   * BSD functions in POSIX
   */
  
+ #ifndef   LOCK_SH
+ 
  #define   LOCK_SH   1    /* shared lock */
  #define   LOCK_EX   2    /* exclusive lock */
  #define   LOCK_NB   4    /* don't block when locking */
***************
*** 9,14 ****
--- 11,18 ----
  
  int
  flock(int fd, int operation);
+ 
+ #endif /* LOCK_SH */
  
  typedef void    Sigfunc(int);   /* for signal handlers */
  

home help back first fref pref prev next nref lref last post