[comp.os.minix] Bug fix to MINIX 1.2 cp

acw@ihuxy.ATT.COM (Wu) (07/10/87)

Here is the bug fix to MINIX 1.2 cp(1), One usage of cp:

  cp f1 f2 ... dir

MINIX cp can copy even directories to `dir' and they appear as files.
The fix is to check to make sure it is not directory before copying it.

Use the fix command to apply this diff.

---------------------- cut here --------------------------
63a64,73
>       if (stat(argv[i],&sbuf) < 0) {
>               std_err(argv[i]);
>               std_err(": not found\n");
>               continue;
>       }
>       if ((sbuf.st_mode & S_IFMT) == S_IFDIR) {
>               std_err(argv[i]);
>               std_err(": directory\n");
>               continue;
>       }
---------------------- cut here --------------------------

The MINIX 1.1 roff.c invokes done(0) to flush the buffer before the
end of main routine, but it is missing from MINIX 1.2 roff.c.
To fix it, just add `done(0);' before the end of main().


Alex Wu
AT&T Bell Labs, Naperville, Illinois
UUCP: ihnp4!ihuxy!acw
312-979-0856

ted@braggvax.arpa (07/16/87)

>Here is the bug fix to MINIX 1.2 cp(1), One usage of cp:
>
>  cp f1 f2 ... dir
>
>  MINIX cp can copy even directories to `dir' and they appear as files.
>  The fix is to check to make sure it is not directory before copying it.
>
 
Actually, I think v7 (and BSD variants) do let you do a copy of a directory
as a regular file.  In some cases this can be construed as a feature.

				Ted Nolan
				ted@braggvax.arpa