[fix] - fixed example - don't exit on read failure during dirent (it could be a direc...
authorMemphiz <memphis@machzwo.de>
Mon, 12 Sep 2011 16:46:57 +0000 (18:46 +0200)
committerMemphiz <memphis@machzwo.de>
Mon, 12 Sep 2011 16:49:28 +0000 (18:49 +0200)
- fixed sprintf pointer

examples/nfsclient-sync.c

index 449d8e3342d8abaf1764bf8b3d095a6315e8930a..a481652f01489c0fc05c91891bd10ef060efb504 100644 (file)
@@ -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);