diff options
author | Soeren Sandmann <sandmann@redhat.com> | 2006-01-14 04:00:59 +0000 |
---|---|---|
committer | Søren Sandmann Pedersen <ssp@src.gnome.org> | 2006-01-14 04:00:59 +0000 |
commit | 2d525523f85341ee39ed419a2a1c720672d968ab (patch) | |
tree | b4f16a567d0b63b534bee076d7f8fd35029853fa | |
parent | c65bfcc1142e78a9bf8190f6a6558b1ed3a71cb9 (diff) |
Initialize retval.
Fri Jan 13 22:59:48 2006 Soeren Sandmann <sandmann@redhat.com>
* module/sysprof-module.c (sysprof_open): Initialize retval.
* module/sysprof-module.c (sysprof_read): Copy contents of trace,
not tail to the buffer.
-rw-r--r-- | ChangeLog | 7 | ||||
-rw-r--r-- | collector.c | 2 | ||||
-rw-r--r-- | module/sysprof-module.c | 6 |
3 files changed, 12 insertions, 3 deletions
@@ -1,3 +1,10 @@ +Fri Jan 13 22:59:48 2006 Soeren Sandmann <sandmann@redhat.com> + + * module/sysprof-module.c (sysprof_open): Initialize retval. + + * module/sysprof-module.c (sysprof_read): Copy contents of trace, + not tail to the buffer. + Wed Jan 11 20:31:11 2006 Søren Sandmann <sandmann@redhat.com> * process.c (read_maps): Also make offset a gulong (Samuel Mimram) diff --git a/collector.c b/collector.c index 2adb2a4..fd486a9 100644 --- a/collector.c +++ b/collector.c @@ -114,7 +114,7 @@ on_read (gpointer data) if (rd == -1 && errno == EWOULDBLOCK) return; - + g_get_current_time (&now); /* After a reset we ignore samples for a short period so that diff --git a/module/sysprof-module.c b/module/sysprof-module.c index 58507e8..eb4a4b4 100644 --- a/module/sysprof-module.c +++ b/module/sysprof-module.c @@ -175,8 +175,10 @@ sysprof_read(struct file *file, char *buffer, size_t count, loff_t *offset) trace = tail; if (tail++ == &stack_traces[N_TRACES - 1]) tail = &stack_traces[0]; + + BUG_ON(trace->pid == 0); - if (copy_to_user(buffer, tail, sizeof *tail)) + if (copy_to_user(buffer, trace, sizeof *trace)) return -EFAULT; file->private_data = tail; @@ -203,7 +205,7 @@ sysprof_poll(struct file *file, poll_table *poll_table) static int sysprof_open(struct inode *inode, struct file *file) { - int retval; + int retval = 0; if (atomic_inc_return(&client_count) == 1) retval = register_timer_hook (timer_notify); |