conforming to the XSI-compliant version of strerror_r in sp_suerror.
[spfs.git] / libspclient / wstat.c
blob7d8492ae28062ee8ca5474ef9e4f943c09e816c8
1 /*
2 * Copyright (C) 2007 by Latchesar Ionkov <lucho@ionkov.net>
4 * Permission is hereby granted, free of charge, to any person obtaining a
5 * copy of this software and associated documentation files (the "Software"),
6 * to deal in the Software without restriction, including without limitation
7 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
8 * and/or sell copies of the Software, and to permit persons to whom the
9 * Software is furnished to do so, subject to the following conditions:
11 * The above copyright notice and this permission notice (including the next
12 * paragraph) shall be included in all copies or substantial portions of the
13 * Software.
15 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
18 * LATCHESAR IONKOV AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
19 * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
20 * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
21 * DEALINGS IN THE SOFTWARE.
23 #include <stdlib.h>
24 #include <stdio.h>
25 #include <string.h>
26 #include <unistd.h>
27 #include <errno.h>
28 #include "spfs.h"
29 #include "spclient.h"
30 #include "spcimpl.h"
32 int
33 spc_wstat(Spcfsys *fs, char *path, Spwstat *wst)
35 Spfcall *tc, *rc;
36 Spcfid *fid;
37 Spwstat *st;
39 st = NULL;
40 fid = spc_walk(fs, path);
41 if (!fid)
42 return -1;
44 tc = sp_create_twstat(fid->fid, wst, fs->dotu);
45 if (spc_rpc(fs, tc, &rc) < 0) {
46 free(tc);
47 spc_close(fid);
48 return -1;
51 free(tc);
52 free(rc);
53 return 0;