[BACK]Return to last.c CVS log [TXT][DIR] Up to [local] / src / usr.bin / last

Diff for /src/usr.bin/last/last.c between version 1.20 and 1.21

version 1.20, 2002/09/23 04:10:14 version 1.21, 2003/04/05 16:24:59
Line 546 
Line 546 
         char *arg;          char *arg;
 {  {
         char *mval;          char *mval;
           size_t len = 8;
   
         /*          /*
          * kludge -- we assume that all tty's end with           * kludge -- we assume that all tty's end with
Line 553 
Line 554 
          */           */
         if (strlen(arg) == 2) {          if (strlen(arg) == 2) {
                 /* either 6 for "ttyxx" or 8 for "console" */                  /* either 6 for "ttyxx" or 8 for "console" */
                 if (!(mval = malloc((u_int)8)))                  if (!(mval = malloc(len)))
                         err(1, "malloc failure");                          err(1, "malloc failure");
                 if (!strcmp(arg, "co"))                  if (!strcmp(arg, "co"))
                         (void)strcpy(mval, "console");                          (void)strlcpy(mval, "console", len);
                 else {                  else
                         (void)strcpy(mval, "tty");                          snprintf(mval, len, "tty%s", arg);
                         (void)strcpy(mval + 3, arg);  
                 }  
                 return (mval);                  return (mval);
         }          }
         if (!strncmp(arg, _PATH_DEV, sizeof(_PATH_DEV) - 1))          if (!strncmp(arg, _PATH_DEV, sizeof(_PATH_DEV) - 1))

Legend:
Removed from v.1.20  
changed lines
  Added in v.1.21