Size 0 in copyfile copies entire file (semantics of <0 reserved)

Also updated documentation

Signed-off-by: Claudio Matsuoka <cmatsuoka@gmail.com>
This commit is contained in:
Claudio Matsuoka committed 2008-02-17 08:11:51 -03:00
1 parent dbb31994a0
commit d17c3160bd
2 files changed
+7 -5

No files matched your search

+5 -3
View File
@@ -56,9 +56,9 @@ Using finit with alternative systems
Currently tested only with Mandriva 2008. Proceed with caution, there are Currently tested only with Mandriva 2008. Proceed with caution, there are
problems related to udev and pam. problems related to udev and pam.
1 - add init=/sbin/finit-mdv to the kernel boot line 1 - Add init=/sbin/finit-mdv to the kernel boot line
2 - provide a suitable /usr/sbin/services.sh, this is the one I use in my 2 - Provide a suitable /usr/sbin/services.sh, this is the one I use in my
test system: test system:
mkdir /var/lock/subsys mkdir /var/lock/subsys
@@ -69,5 +69,7 @@ problems related to udev and pam.
/etc/init.d/portmap start /etc/init.d/portmap start
/etc/init.d/nfs-common start /etc/init.d/nfs-common start
3 - Create /etc/hostname if you don't have it already 3 - Provide /etc/hostname if you don't have it already
4 - Set the pointer device in the X server configuration to /dev/input/mice
+2 -2
View File
@@ -71,8 +71,8 @@ void copyfile(char *src, char *dst, int size)
if ((s = open(src, O_RDONLY)) >= 0) { if ((s = open(src, O_RDONLY)) >= 0) {
if ((d = open(dst, O_WRONLY | O_CREAT, 0644)) >= 0) { if ((d = open(dst, O_WRONLY | O_CREAT, 0644)) >= 0) {
/* Size <= 0 means copy entire file */ /* Size == 0 means copy entire file */
if (size <= 0) { if (size == 0) {
do { do {
if ((n = read(s, buffer, BUF_SIZE)) > 0) if ((n = read(s, buffer, BUF_SIZE)) > 0)
write(d, buffer, n); write(d, buffer, n);