6 #define RW_BUF_SIZE (ulong)4096
10 * @param[out] dst FIXME
12 int copy_file(const char *src
, const char *dst
)
15 int srcfd
= 0, dstfd
= 0;
19 rw_buf
= xmalloc(RW_BUF_SIZE
);
21 srcfd
= open(src
, O_RDONLY
);
23 printf("could not open %s: %s\n", src
, errno_str());
27 dstfd
= open(dst
, O_WRONLY
| O_CREAT
);
29 printf("could not open %s: %s\n", dst
, errno_str());
34 r
= read(srcfd
, rw_buf
, RW_BUF_SIZE
);
41 w
= write(dstfd
, rw_buf
, r
);