ref: 21766da20d69e852ca34fa89e15becfae82909bf
parent: bf8492295e5669793b6279704c43ec06ed305849
author: kvik <kvik@a-b.xyz>
date: Tue Oct 30 15:13:48 EDT 2018
use dirfwstat instead of dirwstat in cloneattr
--- a/clone.c
+++ b/clone.c
@@ -46,7 +46,7 @@
Dir *mkdir(char*, Dir*, int);
int same(Dir*, Dir*);
void clone(char*, char*);
-void cloneattr(char*, Dir*);
+void cloneattr(int, Dir*);
void clonedir(char*, char*);
void clonefile(File*);
File *filenew(char*, char*, Dir*);
@@ -122,6 +122,7 @@
fd = create(name, 0, d->mode | 0200);
if(fd < 0)
error("can't create destination directory");
+ cloneattr(fd, d);
if(dostat){
dd = dirfstat(fd);
if(dd == nil)
@@ -132,7 +133,7 @@
}
void
-cloneattr(char *name, Dir *d)
+cloneattr(int fd, Dir *d)
{
Dir dd;
@@ -147,7 +148,7 @@
dd.uid = d->uid;
if(keepgroup)
dd.gid = d->gid;
- if(dirwstat(name, &dd) < 0)
+ if(dirfwstat(fd, &dd) < 0)
error("can't wstat");
}
@@ -225,7 +226,6 @@
dst = smprint("%s/%s", dst, filename(src));
skipdir = mkdir(dst, sd, 1);
clonedir(src, dst);
- cloneattr(dst, sd);
}
void
@@ -254,7 +254,6 @@
if(d->mode & DMDIR){
mkdir(dn, d, 0);
clonedir(sn, dn);
- cloneattr(dn, d);
}else{
f = filenew(sn, dn, d);
sendp(filechan, f);
@@ -374,7 +373,7 @@
error("fileproc: can't create");
clonefile(f);
- cloneattr(f->dst, f);
+ cloneattr(f->dfd, f);
filefree(f);
}
}