shithub: clone

Download patch

ref: ca6d4e147a635259bc0c8ec63366953b45f84aa0
parent: dd1c98c3c701af9aab9c1f0a7331fd08eacc6a60
author: kvik <[email protected]>
date: Wed Oct 31 10:49:55 EDT 2018

force mkdir to always create a directory

--- a/clone.c
+++ b/clone.c
@@ -103,13 +103,16 @@
 mkdir(char *name, Dir *d, int dostat)
 {
 	int fd;
+	Dir dn;
 	Dir *dd;
 
 	dd = nil;
-	fd = create(name, 0, d->mode | 0200);
+	dn = *d;
+	dn.mode = dn.mode | DMDIR | 0200;
+	fd = create(name, 0, dn.mode);
 	if(fd < 0)
 		sysfatal("can't create destination directory: %r");
-	cloneattr(fd, d);
+	cloneattr(fd, &dn);
 	if(dostat){
 		dd = dirfstat(fd);
 		if(dd == nil)