version 1.84, 2007/03/20 03:50:39 |
version 1.85, 2009/09/10 13:03:35 |
|
|
} |
} |
|
|
/* |
/* |
* Move a file using rename(2) is possible and copying if not. |
* Move a file using rename(2) if possible and copying if not. |
*/ |
*/ |
int |
int |
movefile(char *from, char *to, uid_t owner_uid, gid_t group_gid, mode_t perm) |
movefile(char *from, char *to, uid_t owner_uid, gid_t group_gid, mode_t perm) |
|
|
if (ferror(src)) |
if (ferror(src)) |
err(1, "error reading from %s", from); |
err(1, "error reading from %s", from); |
if ((fclose(src)) != 0) |
if ((fclose(src)) != 0) |
err(1, "can't fclose %s", to); |
|
if ((fclose(dst)) != 0) |
|
err(1, "can't fclose %s", from); |
err(1, "can't fclose %s", from); |
|
if ((fclose(dst)) != 0) |
|
err(1, "can't fclose %s", to); |
if ((unlink(from)) != 0) |
if ((unlink(from)) != 0) |
err(1, "can't unlink %s", from); |
err(1, "can't unlink %s", from); |
|
|