version 1.2, 2005/05/28 08:07:45 |
version 1.3, 2013/03/10 10:34:33 |
|
|
#include "util.h" |
#include "util.h" |
|
|
int |
int |
copy_permissions(char *srcfile, char *dstfile) |
copy_permissions(int srcfd, int dstfd) |
{ |
{ |
struct stat st; |
struct stat st; |
|
|
if (stat(srcfile, &st) < 0) |
if (fstat(srcfd, &st) < 0) |
return (-1); |
return (-1); |
|
|
if (chmod(dstfile, st.st_mode) < 0) |
if (fchown(dstfd, st.st_uid, st.st_gid) < 0) |
return (-1); |
return (-1); |
|
|
if (chown(dstfile, st.st_uid, st.st_gid) < 0) |
if (fchmod(dstfd, st.st_mode) < 0) |
return (-1); |
return (-1); |
|
|
return (0); |
return (0); |