[hackers] [libixp] Return the full pathname of a failed walk.

From: Kris Maglione <jg_AT_suckless.org>
Date: Sat Mar 10 05:31:40 2007

changeset: 43:4a5a99ed5aad
tag: tip
user: Kris Maglione <jg_AT_suckless.org>
date: Fri Mar 09 23:26:54 2007 -0500
summary: Return the full pathname of a failed walk.

diff -r ec7a9e1b5a83 -r 4a5a99ed5aad client.c
--- a/client.c Tue Mar 06 04:09:20 2007 -0500
+++ b/client.c Fri Mar 09 23:26:54 2007 -0500
@@ -94,14 +94,15 @@ int
 int
 ixp_client_walk(IXPClient *c, uint newfid, char *filepath) {
         uint i;
- char *wname[IXP_MAX_WELEM];
+ char *wname[IXP_MAX_WELEM], *fp;
 
         c->ifcall.type = TWALK;
         c->ifcall.fid = c->root_fid;
         c->ifcall.newfid = newfid;
         if(filepath) {
                 // c->ifcall.name = filepath; // tcreate overlaps with twalk !!!
- c->ifcall.nwname = ixp_tokenize(wname, IXP_MAX_WELEM, filepath, '/'); // was "c->ifcall.name"
+ fp = ixp_estrdup(filepath);
+ c->ifcall.nwname = ixp_tokenize(wname, IXP_MAX_WELEM, fp, '/'); // was "c->ifcall.name"
                 for(i = 0; i < c->ifcall.nwname; i++)
                         c->ifcall.wname[i] = wname[i];
         }
diff -r ec7a9e1b5a83 -r 4a5a99ed5aad ixpc.c
--- a/ixpc.c Tue Mar 06 04:09:20 2007 -0500
+++ b/ixpc.c Fri Mar 09 23:26:54 2007 -0500
@@ -281,12 +281,11 @@ main(int argc, char *argv[]) {
         else if(!strncmp(cmd, "write", 6))
                 ret = xwrite(file, P9OWRITE);
         else if(!strncmp(cmd, "xwrite", 7)) {
- if(i < argc)
- ixp_strlcat(buffer, argv[i++], 1023);
                 while(i < argc) {
- ixp_strlcat(buffer, " ", 1024);
                         if(ixp_strlcat(buffer, argv[i++], 1024) > 1023)
                                 break;
+ if(i < argc)
+ ixp_strlcat(buffer, " ", 1024);
                 }
                 ret = xawrite(file, P9OWRITE);
         }else {
Received on Sat Mar 10 2007 - 05:31:40 UTC

This archive was generated by hypermail 2.2.0 : Sun Jul 13 2008 - 15:56:15 UTC