Changeset 4646 for trunk/Nebulous/nebclient/src/nebclient.c
- Timestamp:
- Jul 28, 2005, 11:55:52 AM (21 years ago)
- File:
-
- 1 edited
-
trunk/Nebulous/nebclient/src/nebclient.c (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Nebulous/nebclient/src/nebclient.c
r4639 r4646 4 4 * Copyright (C) 2005 Joshua Hoblitt 5 5 * 6 * $Id: nebclient.c,v 1. 29 2005-07-28 04:13:32 jhoblitt Exp $6 * $Id: nebclient.c,v 1.30 2005-07-28 21:55:52 jhoblitt Exp $ 7 7 */ 8 8 … … 37 37 static size_t nebParseURI(nebServer *server, const char *URI, char **filename); 38 38 static bool nebNukeFile(nebServer *server, const char *filename); 39 static char *nullstrncpy(char *dest, const char *src, size_t n); 39 40 40 41 nebServer *nebServerAlloc(const char *endpoint) … … 457 458 } 458 459 459 int nebStat(nebServer *server, const char *key) 460 { 461 462 return 0; 460 nebObjectStat *nebStat(nebServer *server, const char *key) 461 { 462 struct ns1__stat_USCOREobjectResponse response; 463 nebObjectStat *stat; 464 int resultElements = 0; 465 char **resultArray = NULL; 466 467 stat = xmalloc(sizeof(nebObjectStat)); 468 469 // FIXME is this leaking memory when response goes out of scope? 470 if (soap_call_ns1__stat_USCOREobject(server->soap, server->endpoint, 471 NULL, (char *)key, &response) != SOAP_OK) { 472 nebSetServerErr(server); 473 return NULL; 474 } 475 476 resultElements = response.result->__size; 477 resultArray = response.result->__ptr; 478 479 if (resultElements != 8) { 480 nebSetErr(server, "server didn't return the proper number of stat elements"); 481 return NULL; 482 } 483 484 nullstrncpy(stat->so_id, resultArray[0], 256); 485 nullstrncpy(stat->ext_id, resultArray[1], 256); 486 nullstrncpy(stat->class_id, resultArray[2], 256); 487 nullstrncpy(stat->comment, resultArray[3], 256); 488 nullstrncpy(stat->read_lock, resultArray[4], 256); 489 nullstrncpy(stat->write_lock, resultArray[5], 256); 490 nullstrncpy(stat->epoch, resultArray[6], 256); 491 nullstrncpy(stat->mtime, resultArray[7], 256); 492 493 return stat; 463 494 } 464 495 … … 681 712 return true; 682 713 } 714 715 static char *nullstrncpy(char *dest, const char *src, size_t n) { 716 if (!src) { 717 dest = NULL; 718 return dest; 719 } 720 721 return strncpy(dest, src, n); 722 }
Note:
See TracChangeset
for help on using the changeset viewer.
