From: Memphiz Date: Mon, 12 Sep 2011 16:46:57 +0000 (+0200) Subject: [fix] - fixed example - don't exit on read failure during dirent (it could be a direc... X-Git-Tag: upstream/1.9.6^2~303 X-Git-Url: https://git.piment-noir.org/?a=commitdiff_plain;h=dba24f1079c0814f2efde0f8394b0c180f868c3c;p=deb_libnfs.git [fix] - fixed example - don't exit on read failure during dirent (it could be a directory - non fatal if read fails on that) - fixed sprintf pointer --- diff --git a/examples/nfsclient-sync.c b/examples/nfsclient-sync.c index 449d8e3..a481652 100644 --- a/examples/nfsclient-sync.c +++ b/examples/nfsclient-sync.c @@ -221,7 +221,7 @@ int main(int argc _U_, char *argv[] _U_) while((nfsdirent = nfs_readdir(nfs, nfsdir)) != NULL) { char filename[1024]; printf("Inode:%d Name:%s ", (int)nfsdirent->inode, nfsdirent->name); - sprintf(&filename, "%s/%s", NFSDIR, nfsdirent->name); + sprintf(filename, "%s/%s", NFSDIR, nfsdirent->name); ret = nfs_open(nfs, filename, O_RDONLY, &nfsfh); if (ret != 0) { printf("Failed to open(%s) %s\n", filename, nfs_get_error(nfs)); @@ -230,7 +230,6 @@ int main(int argc _U_, char *argv[] _U_) ret = nfs_read(nfs, nfsfh, sizeof(buf), buf); if (ret < 0) { printf("Error reading file\n"); - exit(10); } printf("Read %d bytes\n", ret); ret = nfs_close(nfs, nfsfh);