Changeset 24999
- Timestamp:
- Aug 4, 2009, 2:50:13 PM (17 years ago)
- Location:
- trunk/Nebulous/nebclient
- Files:
-
- 3 edited
-
src/nebclient.c (modified) (5 diffs)
-
src/nebclient.h (modified) (1 diff)
-
tests/tests.c (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Nebulous/nebclient/src/nebclient.c
r24997 r24999 812 812 } 813 813 814 nullstrncpy(stat->so_id, resultArray[0], 256);815 nullstrncpy(stat->ext_id, resultArray[1], 256);816 nullstrncpy(stat->read_lock, resultArray[2], 256);814 stat->so_id = atol(resultArray[0]); 815 stat->ext_id = atol(resultArray[1]); 816 stat->read_lock = atoi(resultArray[2]); 817 817 nullstrncpy(stat->write_lock, resultArray[3], 256); 818 818 nullstrncpy(stat->epoch, resultArray[4], 256); … … 831 831 } 832 832 833 xfree(stat->so_id); 834 xfree(stat->ext_id); 835 xfree(stat->read_lock); 836 xfree(stat->write_lock); 837 xfree(stat->epoch); 838 xfree(stat->mtime); 839 xfree(stat); 833 nebFree(stat); 840 834 } 841 835 … … 935 929 return -1; 936 930 } 931 932 int available = stat->available; 933 nebObjectStatFree(stat); 934 937 935 // start at one so cull() is called one less time then the # of 938 936 // instances 939 for (long i = 1; i < stat->available; i++) {937 for (long i = 1; i < available; i++) { 940 938 if (!nebCull(server, key)) { 941 nebObjectStatFree(stat);942 939 return -1; 943 940 } 944 941 removed++; 945 942 } 946 nebObjectStatFree(stat);947 943 } 948 944 … … 958 954 959 955 void nebFree(void *ptr) { 956 if (!ptr) { return; } 960 957 xfree(ptr); 961 958 } … … 1197 1194 } 1198 1195 1196 if (!dest) { 1197 dest = xmalloc(n + 1); 1198 } 1199 1199 1200 return strncpy(dest, src, n); 1200 1201 } -
trunk/Nebulous/nebclient/src/nebclient.h
r24939 r24999 38 38 39 39 typedef struct { 40 char so_id[256];///< storage object ID41 char ext_id[256];///< storage object key (name)42 char read_lock[256];///< read lock value40 long so_id; ///< storage object ID 41 long ext_id; ///< storage object key (name) 42 int read_lock; ///< read lock value 43 43 char write_lock[256]; ///< write lock value 44 44 char epoch[256]; ///< creation time stamp -
trunk/Nebulous/nebclient/tests/tests.c
r24939 r24999 98 98 99 99 char *copies = nebGetXattr(server, key, "user.copies"); 100 neb_ok(server, strcmp(copies, "2") == 0, "get user.copies xattr");100 neb_ok(server, copies != NULL && strcmp(copies, "2") == 0, "get user.copies xattr"); 101 101 char **xattrs = NULL; 102 102 int n_xattrs = nebListXattr(server, key, &xattrs); 103 printf("# %s\n\n", xattrs[0]); 104 neb_ok(server, n_xattrs == 1, "count of xattrs"); 105 neb_ok(server, strcmp(xattrs[0], "user.copies") == 0, "user.copies xattr exists"); 103 neb_ok(server, xattrs != NULL && n_xattrs == 1, "count of xattrs"); 104 neb_ok(server, xattrs != NULL && strcmp(xattrs[0], "user.copies") == 0, "user.copies xattr exists"); 106 105 neb_ok(server, nebRemoveXattr(server, key, "user.copies"), "remove user.copies xattr"); 107 106
Note:
See TracChangeset
for help on using the changeset viewer.
