summaryrefslogtreecommitdiffstats
path: root/fs
diff options
context:
space:
mode:
authorLatchesar Ionkov <lucho@ionkov.net>2006-02-03 03:04:18 -0800
committerLinus Torvalds <torvalds@g5.osdl.org>2006-02-03 08:32:06 -0800
commit05818a004a84951fd383694f3b35d89eb49fa308 (patch)
treea9c18d8cbcd565ac5d1bf833af8d5161dbca18d3 /fs
parent93c615feffbcea4f09ecee154f46062f6041776e (diff)
downloadblackbird-op-linux-05818a004a84951fd383694f3b35d89eb49fa308.tar.gz
blackbird-op-linux-05818a004a84951fd383694f3b35d89eb49fa308.zip
[PATCH] v9fs: v9fs_put_str fix
v9fs_put_str used to store pointer to the source string, instead of the cbuf copy. This patch corrects it. Signed-off-by: Latchesar Ionkov <lucho@ionkov.net> Cc: Eric Van Hensbergen <ericvh@ericvh.myip.org> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'fs')
-rw-r--r--fs/9p/conv.c28
1 files changed, 19 insertions, 9 deletions
diff --git a/fs/9p/conv.c b/fs/9p/conv.c
index 32a9f99154e2..bf1f10067960 100644
--- a/fs/9p/conv.c
+++ b/fs/9p/conv.c
@@ -116,13 +116,19 @@ static void buf_put_int64(struct cbuf *buf, u64 val)
}
}
-static void buf_put_stringn(struct cbuf *buf, const char *s, u16 slen)
+static char *buf_put_stringn(struct cbuf *buf, const char *s, u16 slen)
{
+ char *ret;
+
+ ret = NULL;
if (buf_check_size(buf, slen + 2)) {
buf_put_int16(buf, slen);
+ ret = buf->p;
memcpy(buf->p, s, slen);
buf->p += slen;
}
+
+ return ret;
}
static inline void buf_put_string(struct cbuf *buf, const char *s)
@@ -430,15 +436,19 @@ static inline void v9fs_put_int64(struct cbuf *bufp, u64 val, u64 * p)
static void
v9fs_put_str(struct cbuf *bufp, char *data, struct v9fs_str *str)
{
- if (data) {
- str->len = strlen(data);
- str->str = bufp->p;
- } else {
- str->len = 0;
- str->str = NULL;
- }
+ int len;
+ char *s;
+
+ if (data)
+ len = strlen(data);
+ else
+ len = 0;
- buf_put_stringn(bufp, data, str->len);
+ s = buf_put_stringn(bufp, data, len);
+ if (str) {
+ str->len = len;
+ str->str = s;
+ }
}
static int
OpenPOWER on IntegriCloud