summaryrefslogtreecommitdiffstats
path: root/runtime/transport/procfs.c
diff options
context:
space:
mode:
authorhunt <hunt>2006-04-11 05:15:46 +0000
committerhunt <hunt>2006-04-11 05:15:46 +0000
commitbfeaee8388e7f23779563bd31f1a478680d498d0 (patch)
tree26d31e95170b7418f7c33cdba081b0f2bf26c150 /runtime/transport/procfs.c
parent10a8db4bedc18df8f8ef14733c6e35b38ca4ef12 (diff)
downloadsystemtap-steved-bfeaee8388e7f23779563bd31f1a478680d498d0.tar.gz
systemtap-steved-bfeaee8388e7f23779563bd31f1a478680d498d0.tar.xz
systemtap-steved-bfeaee8388e7f23779563bd31f1a478680d498d0.zip
2006-04-10 Martin Hunt <hunt@redhat.com>
* procfs.c (_stp_write): More fixes because buffers are no longer null-terminated.
Diffstat (limited to 'runtime/transport/procfs.c')
-rw-r--r--runtime/transport/procfs.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/runtime/transport/procfs.c b/runtime/transport/procfs.c
index 47c1711a..3ca435fc 100644
--- a/runtime/transport/procfs.c
+++ b/runtime/transport/procfs.c
@@ -1,7 +1,7 @@
/* -*- linux-c -*-
*
* /proc transport and control
- * Copyright (C) 2005 Red Hat Inc.
+ * Copyright (C) 2005, 2006 Red Hat Inc.
*
* This file is part of systemtap, and is free software. You can
* redistribute it and/or modify it under the terms of the GNU General
@@ -133,9 +133,11 @@ static int _stp_write (int type, void *data, int len)
spin_lock(&_stp_ready_lock);
if (!list_empty(&_stp_ready_q)) {
bptr = (struct _stp_buffer *)_stp_ready_q.prev;
- if (bptr->len + len <= STP_BUFFER_SIZE && type == STP_REALTIME_DATA && bptr->type == type) {
- memcpy (bptr->buf + bptr->len - 1, data, len);
- bptr->len += len - 1;
+ if (bptr->len + len <= STP_BUFFER_SIZE
+ && type == STP_REALTIME_DATA
+ && bptr->type == STP_REALTIME_DATA) {
+ memcpy (bptr->buf + bptr->len, data, len);
+ bptr->len += len;
spin_unlock(&_stp_ready_lock);
return len;
}
@@ -173,6 +175,8 @@ _stp_proc_read_cmd (struct file *file, char __user *buf, size_t count, loff_t *p
int len;
unsigned long flags;
+ /* FIXME FIXME FIXME. assuming count is large enough to hold buffer!! */
+
/* wait for nonempty ready queue */
spin_lock_irqsave(&_stp_ready_lock, flags);
while (list_empty(&_stp_ready_q)) {