Added mode bits copying
This commit is contained in:
parent
261174c8c4
commit
9a6d1dfbea
@ -3,6 +3,7 @@
|
||||
#include <stdlib.h>
|
||||
#include <fcntl.h>
|
||||
#include <unistd.h>
|
||||
#include <sys/stat.h>
|
||||
|
||||
#define BUFFER_SIZE 8
|
||||
|
||||
@ -36,6 +37,11 @@ int cp(char *argv[]){
|
||||
write(new, buffer, read_bytes);
|
||||
}
|
||||
|
||||
struct stat mod_bits;
|
||||
|
||||
stat(argv[1], &mod_bits);
|
||||
chmod(argv[2], mod_bits.st_mode);
|
||||
|
||||
close(old);
|
||||
close(new);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user