X-Git-Url: https://git.piment-noir.org/?a=blobdiff_plain;f=utils%2Fnfs-ls.c;h=53152fc9c08e91b2948b13d18d46a9e853ed485e;hb=2db42ce2fc89bc88050564037688888bbb8876e9;hp=c680617effc5e1ee640b96cea114f1c56f70e2dd;hpb=c7ddf2e5cbd6505895d59aebb1c620ea2c7eabc7;p=deb_libnfs.git diff --git a/utils/nfs-ls.c b/utils/nfs-ls.c index c680617..53152fc 100644 --- a/utils/nfs-ls.c +++ b/utils/nfs-ls.c @@ -51,7 +51,6 @@ WSADATA wsaData; #include #include #include -#include "libnfs-zdr.h" #include "libnfs.h" #include "libnfs-raw.h" #include "libnfs-raw-mount.h" @@ -91,7 +90,6 @@ void process_dir(struct nfs_context *nfs, char *dir, int level) { struct nfsdirent *nfsdirent; struct statvfs svfs; struct nfsdir *nfsdir; - struct nfs_stat_64 st; if (!level) { printf("Recursion detected!\n"); @@ -109,15 +107,9 @@ void process_dir(struct nfs_context *nfs, char *dir, int level) { if (!strcmp(nfsdirent->name, ".") || !strcmp(nfsdirent->name, "..")) { continue; } - snprintf(path, 1024, "%s/%s", dir, nfsdirent->name); - ret = nfs_stat64(nfs, path, &st); - if (ret != 0) { - fprintf(stderr, "Failed to stat(%s) %s\n", path, nfs_get_error(nfs)); - continue; - } - switch (st.nfs_mode & S_IFMT) { + switch (nfsdirent->mode & S_IFMT) { #ifndef WIN32 case S_IFLNK: printf("l"); @@ -137,28 +129,28 @@ void process_dir(struct nfs_context *nfs, char *dir, int level) { break; } printf("%c%c%c", - "-r"[!!(st.nfs_mode & S_IRUSR)], - "-w"[!!(st.nfs_mode & S_IWUSR)], - "-x"[!!(st.nfs_mode & S_IXUSR)] + "-r"[!!(nfsdirent->mode & S_IRUSR)], + "-w"[!!(nfsdirent->mode & S_IWUSR)], + "-x"[!!(nfsdirent->mode & S_IXUSR)] ); printf("%c%c%c", - "-r"[!!(st.nfs_mode & S_IRGRP)], - "-w"[!!(st.nfs_mode & S_IWGRP)], - "-x"[!!(st.nfs_mode & S_IXGRP)] + "-r"[!!(nfsdirent->mode & S_IRGRP)], + "-w"[!!(nfsdirent->mode & S_IWGRP)], + "-x"[!!(nfsdirent->mode & S_IXGRP)] ); printf("%c%c%c", - "-r"[!!(st.nfs_mode & S_IROTH)], - "-w"[!!(st.nfs_mode & S_IWOTH)], - "-x"[!!(st.nfs_mode & S_IXOTH)] + "-r"[!!(nfsdirent->mode & S_IROTH)], + "-w"[!!(nfsdirent->mode & S_IWOTH)], + "-x"[!!(nfsdirent->mode & S_IXOTH)] ); - printf(" %2d", (int)st.nfs_nlink); - printf(" %5d", (int)st.nfs_uid); - printf(" %5d", (int)st.nfs_gid); - printf(" %12" PRId64, st.nfs_size); + printf(" %2d", (int)nfsdirent->nlink); + printf(" %5d", (int)nfsdirent->uid); + printf(" %5d", (int)nfsdirent->gid); + printf(" %12" PRId64, nfsdirent->size); printf(" %s\n", path + 1); - if (recursive && (st.nfs_mode & S_IFMT) == S_IFDIR) { + if (recursive && (nfsdirent->mode & S_IFMT) == S_IFDIR) { process_dir(nfs, path, level - 1); } } @@ -172,7 +164,7 @@ int main(int argc, char *argv[]) uint64_t offset; struct client client; struct statvfs stvfs; - struct nfs_url *url; + struct nfs_url *url = NULL; exports export, tmp; #ifdef WIN32