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

Diff for /src/usr.bin/file/Attic/apprentice.c between version 1.16 and 1.17

version 1.16, 2003/03/11 21:26:26 version 1.17, 2003/04/07 19:03:46
Line 71 
Line 71 
 {  {
         char *p, *mfn;          char *p, *mfn;
         int file_err, errs = -1;          int file_err, errs = -1;
           size_t len;
   
         maxmagic = MAXMAGIS;          maxmagic = MAXMAGIS;
         magic = (struct magic *) calloc(maxmagic, sizeof(struct magic));          magic = (struct magic *) calloc(maxmagic, sizeof(struct magic));
         mfn = malloc(strlen(fn)+1);          len = strlen(fn)+1;
           mfn = malloc(len);
         if (magic == NULL || mfn == NULL) {          if (magic == NULL || mfn == NULL) {
                 warn("malloc");                  warn("malloc");
                 if (check)                  if (check)
Line 82 
Line 84 
                 else                  else
                         exit(1);                          exit(1);
         }          }
         fn = strcpy(mfn, fn);   /* ok */          strlcpy(mfn, fn, len);
           fn = mfn;
   
         while (fn) {          while (fn) {
                 p = strchr(fn, ':');                  p = strchr(fn, ':');
                 if (p)                  if (p)

Legend:
Removed from v.1.16  
changed lines
  Added in v.1.17