shithub: clone

Download patch

ref: 77d6351a86a29a70aeb1d67e34a657cc0e677dd3
parent: 11cbdaac277cb7eff2d8c8102860e7fef8b6a309
author: kvik <kvik@a-b.xyz>
date: Tue Oct 30 21:59:57 EDT 2018

reorder code

--- a/clone.c
+++ b/clone.c
@@ -118,26 +118,6 @@
 	return dd;
 }
 
-void
-cloneattr(int fd, Dir *d)
-{
-	Dir dd;
-
-	if(!(keepmode || keepuser || keepgroup || keepmtime))
-		return;
-	nulldir(&dd);
-	if(keepmode)
-		dd.mode = d->mode & DMDIR ? d->mode|0200 : d->mode;
-	if(keepmtime)
-		dd.mtime = d->mtime;
-	if(keepuser)
-		dd.uid = d->uid;
-	if(keepgroup)
-		dd.gid = d->gid;
-	if(dirfwstat(fd, &dd) < 0)
-		sysfatal("can't wstat");
-}
-
 int
 same(Dir *a, Dir *b)
 {
@@ -180,6 +160,26 @@
 	free(f->src);
 	free(f->dst);
 	free(f);
+}
+
+void
+cloneattr(int fd, Dir *d)
+{
+	Dir dd;
+
+	if(!(keepmode || keepuser || keepgroup || keepmtime))
+		return;
+	nulldir(&dd);
+	if(keepmode)
+		dd.mode = d->mode & DMDIR ? d->mode|0200 : d->mode;
+	if(keepmtime)
+		dd.mtime = d->mtime;
+	if(keepuser)
+		dd.uid = d->uid;
+	if(keepgroup)
+		dd.gid = d->gid;
+	if(dirfwstat(fd, &dd) < 0)
+		sysfatal("can't wstat");
 }
 
 void