changeset: 116:58a562fd2dfa
tag: tip
user: Kris Maglione <kris_AT_suckless.org>
date: Sat Oct 31 18:06:30 2009 -0400
files: include/ixp.h include/ixp_srvutil.h libixp/srv_util.c
description:
Fix ixp_srvutils bug in corner case. Closes issue #150.
diff -r d473abb501f1 -r 58a562fd2dfa include/ixp.h
--- a/include/ixp.h Fri Oct 30 17:37:04 2009 -0400
+++ b/include/ixp.h Sat Oct 31 18:06:30 2009 -0400
@@ -7,7 +7,7 @@
#include <sys/types.h>
#include <sys/select.h>
-#define IXP_API 105
+#define IXP_API 116
/* Gunk */
#if defined(IXP_NEEDAPI) && IXP_API < IXP_NEEDAPI
diff -r d473abb501f1 -r 58a562fd2dfa include/ixp_srvutil.h
--- a/include/ixp_srvutil.h Fri Oct 30 17:37:04 2009 -0400
+++ b/include/ixp_srvutil.h Sat Oct 31 18:06:30 2009 -0400
@@ -55,7 +55,7 @@
void ixp_pending_pushfid(IxpPending*, IxpFid*);
void ixp_pending_respond(Ixp9Req*);
void ixp_pending_write(IxpPending*, char*, long);
-void ixp_srv_clonefiles(IxpFileId*);
+IxpFileId* ixp_srv_clonefiles(IxpFileId*);
void ixp_srv_data2cstring(Ixp9Req*);
void ixp_srv_freefile(IxpFileId*);
void ixp_srv_readbuf(Ixp9Req*, char*, uint);
diff -r d473abb501f1 -r 58a562fd2dfa libixp/srv_util.c
--- a/libixp/srv_util.c Fri Oct 30 17:37:04 2009 -0400
+++ b/libixp/srv_util.c Sat Oct 31 18:06:30 2009 -0400
@@ -75,10 +75,17 @@
* Increase the reference count of every IxpFileId linked
* to 'f'.
*/
-void
+IxpFileId*
ixp_srv_clonefiles(IxpFileId *f) {
- for(; f; f=f->next)
+ IxpFileId *r;
+
+ r = emalloc(sizeof *r);
+ memcpy(r, f, sizeof *r);
+ r->tab.name = estrdup(r->tab.name);
+ r->nref = 1;
+ for(f=f->next; f; f=f->next)
assert(f->nref++);
+ return r;
}
void
@@ -404,8 +411,7 @@
IxpFileId *file, *tfile;
int i;
- file = req->fid->aux;
- ixp_srv_clonefiles(file);
+ file = ixp_srv_clonefiles(req->fid->aux);
for(i=0; i < req->ifcall.twalk.nwname; i++) {
if(!strcmp(req->ifcall.twalk.wname[i], "..")) {
if(file->next) {
Received on Sat Oct 31 2009 - 22:09:25 UTC
This archive was generated by hypermail 2.2.0 : Sat Oct 31 2009 - 22:12:05 UTC