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

Diff for /src/usr.bin/signify/zsig.c between version 1.2 and 1.3

version 1.2, 2016/09/02 16:12:09 version 1.3, 2016/09/02 21:48:03
Line 71 
Line 71 
                         sz *= 2;                          sz *= 2;
                         buf = realloc(buf, sz);                          buf = realloc(buf, sz);
                         if (!buf)                          if (!buf)
                                 exit(1);                                  err(1, "realloc");
                 }                  }
                 n = read(fd, buf+len, sz-len);                  n = read(fd, buf+len, sz-len);
                 if (n == -1)                  if (n == -1)
                         exit(1);                          err(1, "read");
                 /* incomplete info */                  /* incomplete info */
                 if (n == 0)                  if (n == 0)
                         exit(1);                          errx(1, "gzheader truncated");
                 len += n;                  len += n;
                 h->comment = NULL;                  h->comment = NULL;
                 h->name = NULL;                  h->name = NULL;
Line 95 
Line 95 
                         h->os = buf[9];                          h->os = buf[9];
                         /* magic gzip header */                          /* magic gzip header */
                         if (buf[0] != 0x1f || buf[1] != 0x8b || buf[2] != 8)                          if (buf[0] != 0x1f || buf[1] != 0x8b || buf[2] != 8)
                                 exit(1);                                  err(1, "invalud magic in gzheader");
                         /* XXX special code that only caters to our needs */                          /* XXX special code that only caters to our needs */
                         if (h->flg & ~ (FCOMMENT_FLAG | FNAME_FLAG))                          if (h->flg & ~ (FCOMMENT_FLAG | FNAME_FLAG))
                                 exit(1);                                  err(1, "invalid flags in gzheader");
                         pos = 10;                          pos = 10;
                         state++;                          state++;
                         /*FALLTHRU*/                          /*FALLTHRU*/
Line 157 
Line 157 
                 while (n != bufsize) {                  while (n != bufsize) {
                         ssize_t more = read(fdin, buffer+n, bufsize-n);                          ssize_t more = read(fdin, buffer+n, bufsize-n);
                         if (more == -1)                          if (more == -1)
                                 exit(1);                                  err(1, "read");
                         n += more;                          n += more;
                         if (more == 0)                          if (more == 0)
                                 break;                                  break;

Legend:
Removed from v.1.2  
changed lines
  Added in v.1.3