version 1.8, 2009/05/27 07:29:47 |
version 1.9, 2009/11/05 14:39:15 |
|
|
|
|
#include <sys/queue.h> |
#include <sys/queue.h> |
#include <sys/stat.h> |
#include <sys/stat.h> |
|
#ifdef __NetBSD__ |
#include <sys/syslimits.h> |
#include <sys/syslimits.h> |
|
#elif !defined(PATH_MAX) |
|
#define PATH_MAX (1024) |
|
#endif |
|
|
|
#if HAVE_NBCOMPAT_H |
|
#include <nbcompat.h> |
|
#endif |
|
|
#include <dirent.h> |
#include <dirent.h> |
#include <err.h> |
#include <err.h> |
Line 157 fsu_ecp(struct ukfs *fs, const char *fro |
|
Line 165 fsu_ecp(struct ukfs *fs, const char *fro |
|
{ |
{ |
struct stat from_stat, to_stat; |
struct stat from_stat, to_stat; |
int rv; |
int rv; |
|
|
if (flags & FSU_ECP_PUT) |
if (flags & FSU_ECP_PUT) |
rv = lstat(from, &from_stat); |
rv = lstat(from, &from_stat); |
else |
else |
Line 200 copy_dir(struct ukfs *fs, const char *fr |
|
Line 208 copy_dir(struct ukfs *fs, const char *fr |
|
warn("%s", to); |
warn("%s", to); |
return -1; |
return -1; |
} |
} |
|
|
if (flags & FSU_ECP_GET) |
if (flags & FSU_ECP_GET) |
rv = lstat(to, &file_stat); |
rv = lstat(to, &file_stat); |
else |
else |
Line 221 copy_dir(struct ukfs *fs, const char *fr |
|
Line 229 copy_dir(struct ukfs *fs, const char *fr |
|
} |
} |
|
|
flen = strlen(filename); |
flen = strlen(filename); |
|
|
rv = strlcat(to_p, filename, PATH_MAX + 1); |
rv = strlcat(to_p, filename, PATH_MAX + 1); |
if (rv != (int)(flen + tlen + 1)) { |
if (rv != (int)(flen + tlen + 1)) { |
warn("%s/%s", to_p, filename); |
warn("%s/%s", to_p, filename); |
Line 263 copy_dir_rec(struct ukfs *fs, const char |
|
Line 271 copy_dir_rec(struct ukfs *fs, const char |
|
flist_options |= FSU_FLIST_REALFS; |
flist_options |= FSU_FLIST_REALFS; |
|
|
len = strlen(to_p) - 1; |
len = strlen(to_p) - 1; |
|
|
flist = fsu_flist_build(fs, from_p, flist_options); |
flist = fsu_flist_build(fs, from_p, flist_options); |
if (flist == NULL) |
if (flist == NULL) |
return -1; |
return -1; |
Line 322 copy_dir_rec(struct ukfs *fs, const char |
|
Line 330 copy_dir_rec(struct ukfs *fs, const char |
|
} |
} |
LIST_INSERT_HEAD(&hl_l, new, next); |
LIST_INSERT_HEAD(&hl_l, new, next); |
} |
} |
|
|
if (flags & FSU_ECP_GET) |
if (flags & FSU_ECP_GET) |
rv = mkdir(to_p, root->sb.st_mode); |
rv = mkdir(to_p, root->sb.st_mode); |
else |
else |
Line 364 copy_dir_rec(struct ukfs *fs, const char |
|
Line 372 copy_dir_rec(struct ukfs *fs, const char |
|
res = -1; |
res = -1; |
break; |
break; |
} |
} |
|
|
rv = ukfs_chown(fs, to_p, cur->sb.st_uid, |
rv = ukfs_chown(fs, to_p, cur->sb.st_uid, |
cur->sb.st_gid); |
cur->sb.st_gid); |
if (rv == -1) { |
if (rv == -1) { |
Line 415 copy_dir_rec(struct ukfs *fs, const char |
|
Line 423 copy_dir_rec(struct ukfs *fs, const char |
|
if (flags & FSU_ECP_GET) |
if (flags & FSU_ECP_GET) |
copy_fileout(hlfrom, hlto); |
copy_fileout(hlfrom, hlto); |
else |
else |
copy_filein(fs, hlfrom, hlto); |
copy_filein(fs, hlfrom, hlto); |
|
|
} |
} |
|
|
free(new->hl_to[curlink]); |
free(new->hl_to[curlink]); |
} |
} |
|
free(new->hl_to); |
free(new->hl_from); |
|
free(new); |
free(new); |
} |
} |
|
|
Line 534 copy_file(struct ukfs *fs, const char *f |
|
Line 539 copy_file(struct ukfs *fs, const char *f |
|
warn("%s", to); |
warn("%s", to); |
return -1; |
return -1; |
} |
} |
|
|
off = 0; |
off = 0; |
do { |
do { |
if (flags & FSU_ECP_PUT) |
if (flags & FSU_ECP_PUT) |
Line 607 copy_fifo(struct ukfs *fs, const char *f |
|
Line 612 copy_fifo(struct ukfs *fs, const char *f |
|
warn("%s", to); |
warn("%s", to); |
return -1; |
return -1; |
} |
} |
|
|
return 0; |
return 0; |
} |
} |
|
|
Line 649 copy_special(struct ukfs *fs, const char |
|
Line 654 copy_special(struct ukfs *fs, const char |
|
warn("%s", to); |
warn("%s", to); |
return -1; |
return -1; |
} |
} |
|
|
return 0; |
return 0; |
} |
} |
|
|
Line 719 copy_filein(struct ukfs *fs, const char |
|
Line 724 copy_filein(struct ukfs *fs, const char |
|
warn("%s", to); |
warn("%s", to); |
return -1; |
return -1; |
} |
} |
|
|
off = 0; |
off = 0; |
do { |
do { |
rd = ukfs_read(fs, from, off, buf, sizeof(buf)); |
rd = ukfs_read(fs, from, off, buf, sizeof(buf)); |