Cover V08, I09
Article
Listing 1

sep99.tar


Listing 1: ls.c

*** ls.c        Wed May 12 16:27:34 1999 
--- ls.c.orig   Sun Aug  2 18:47:11 1998 
***************
*** 62,68 ****
  #include <string.h>
  #include <unistd.h>
  #include <locale.h>
- #include <syslog.h>
     
  #include "ls.h"
  #include "extern.h"
--- 62,67 ----
***************
*** 111,120 ****
  {
        static char dot[] = ".", *dotav[] = { dot, NULL }; 
        struct winsize win;
!       int ch, fts_options, notused, i; 
!       int argvsize = 0;
        char *p;
-       char *argvbuf;
     
        (void) setlocale(LC_ALL, "");
     
--- 110,117 ----
  {
        static char dot[] = ".", *dotav[] = { dot, NULL }; 
        struct winsize win;
!       int ch, fts_options, notused;
        char *p;
     
        (void) setlocale(LC_ALL, "");
     
***************
*** 136,156 ****
                        termwidth = atoi(p);
        }
     
!   for (i = 0; i < argc; argvsize += strlen(argv[i++])); 
!   argvsize += argc;
!   if (!(argvbuf = malloc(argvsize))) {
!     syslog(LOG_ERR, "can't allocate memory to store command line"); 
!     exit(1);
!   };
!   for (i = 0, *argvbuf = 0; i < argc;) { 
!     strcat(argvbuf, argv[i]);
!     if (++i < argc)
!       strcat(argvbuf, " ");
!   };
! 
!   
!   syslog(LOG_LOCAL5, "BOOM: '%s' run by uid %d on %s", argvbuf, getuid(), 
ttyname(2));   
! 
    /* Root is -A automatically. */
    if (!getuid())
                f_listdot = 1;
     
        fts_options = FTS_PHYSICAL;
--- 132,137 ----