1: #
   2: /* flag version 6 a.outs by putting a 1 in word 6 */
   3: #include <stdio.h>
   4: #include <sys/types.h>
   5: #include <sys/stat.h>
   6: struct stat stbuf;
   7: int fd;
   8: short   hbuf[8];
   9: time_t  timep[2];
  10: main(argc, argv) char *argv[]; {
  11:     if(stat(argv[1], &stbuf) < 0) exit(0);
  12:     if(!(stbuf.st_mode & S_IEXEC)) exit(0);
  13:     if((fd = open(argv[1], 2)) < 0) exit(0);
  14:     if(read(fd, hbuf, sizeof hbuf) != sizeof hbuf) exit(0);
  15:     lseek(fd, 0L, 0);
  16:     if(hbuf[0]!=0407&&hbuf[0]!=0410&&hbuf[0]!=0411&&hbuf[0]!=0405) exit(0);
  17:     if(hbuf[6] != 0) exit(0);
  18:     hbuf[6] = 01;
  19:     if(write(fd, hbuf, sizeof hbuf) != sizeof hbuf) exit(0);
  20:     close(fd);
  21:     timep[0] = stbuf.st_atime;
  22:     timep[1] = stbuf.st_mtime;
  23:     utime(argv[1], timep);
  24:     printf("%s fixed\n",argv[1]);
  25: }

Defined functions

main defined in line 10; never used

Defined variables

fd defined in line 7; used 5 times
hbuf defined in line 8; used 12 times
stbuf defined in line 6; used 4 times
Last modified: 1982-06-09
Generated: 2016-12-26
Generated by src2html V0.67
page hit count: 855
Valid CSS Valid XHTML 1.0 Strict