version 1.1.1.1, 2008/06/03 10:38:47 |
version 1.1.1.1.2.1, 2008/08/13 17:12:33 |
|
|
|
|
if ((fold = open(from, 0)) == -1) { |
if ((fold = open(from, 0)) == -1) { |
warn("%s", from); |
warn("%s", from); |
return (1); |
return 1; |
} |
} |
fstat(fold, &stbuf); |
fstat(fold, &stbuf); |
mode = stbuf.st_mode; |
mode = stbuf.st_mode; |
|
|
if ((fnew = creat(to, mode)) == -1) { |
if ((fnew = creat(to, mode)) == -1) { |
warn("%s", to); |
warn("%s", to); |
close(fold); |
close(fold); |
return (1); |
return 1; |
} |
} |
while ((n = read(fold, iobuf, BUFSIZ)) > 0) { |
while ((n = read(fold, iobuf, BUFSIZ)) > 0) { |
if (write(fnew, iobuf, n) != n) { |
if (write(fnew, iobuf, n) != n) { |
warn("%s", to); |
warn("%s", to); |
close(fold); |
close(fold); |
close(fnew); |
close(fnew); |
return (1); |
return 1; |
} |
} |
} |
} |
close(fold); |
close(fold); |