libutil/recurse: Use a single path buffer, and directory fd
This way, we don't use PATH_MAX bytes on the stack per path component, and don't have to keep copying the complete path around.
This commit is contained in:
3
mv.c
3
mv.c
@@ -2,6 +2,7 @@
|
||||
#include <sys/stat.h>
|
||||
|
||||
#include <errno.h>
|
||||
#include <fcntl.h>
|
||||
#include <stdio.h>
|
||||
|
||||
#include "fs.h"
|
||||
@@ -21,7 +22,7 @@ mv(const char *s1, const char *s2, int depth)
|
||||
cp_aflag = cp_rflag = cp_pflag = 1;
|
||||
cp_follow = 'P';
|
||||
cp(s1, s2, depth);
|
||||
recurse(s1, NULL, &r);
|
||||
recurse(AT_FDCWD, s1, NULL, &r);
|
||||
return (mv_status = cp_status || rm_status);
|
||||
}
|
||||
mv_status = 1;
|
||||
|
Reference in New Issue
Block a user