summaryrefslogtreecommitdiff
path: root/libps
diff options
context:
space:
mode:
authorJustus Winter <justus@gnupg.org>2017-09-13 14:10:33 +0200
committerJustus Winter <justus@gnupg.org>2017-09-13 14:10:33 +0200
commit1c5e9b5fd65d2c385f5d3f696eb0d05a86fb2755 (patch)
tree82a7293c31238d516d12fa25fcddb2e8339598c0 /libps
parent5018bd32c87250ed3fd4249d050b772750827db0 (diff)
parent89a49ec8b3a847f3b770cff6a4a80b98b94ad7bf (diff)
Merge remote-tracking branch 'mainline/master' into dde
Diffstat (limited to 'libps')
-rw-r--r--libps/context.c2
-rw-r--r--libps/filters.c2
-rw-r--r--libps/fmt.c13
-rw-r--r--libps/host.c2
-rw-r--r--libps/proclist.c10
-rw-r--r--libps/procstat.c12
-rw-r--r--libps/spec.c7
-rw-r--r--libps/tty.c2
-rw-r--r--libps/user.c2
9 files changed, 24 insertions, 28 deletions
diff --git a/libps/context.c b/libps/context.c
index 3082d83b1..8ed159437 100644
--- a/libps/context.c
+++ b/libps/context.c
@@ -21,7 +21,7 @@
#include <hurd.h>
#include <stdio.h>
#include <stdlib.h>
-#include <assert.h>
+#include <assert-backtrace.h>
#include <hurd/term.h>
#include "ps.h"
diff --git a/libps/filters.c b/libps/filters.c
index 6663e61e9..1bc5a0e62 100644
--- a/libps/filters.c
+++ b/libps/filters.c
@@ -21,7 +21,7 @@
#include <hurd.h>
#include <stdio.h>
#include <stdlib.h>
-#include <assert.h>
+#include <assert-backtrace.h>
#include <pwd.h>
#include <unistd.h>
diff --git a/libps/fmt.c b/libps/fmt.c
index 580b097e7..464166326 100644
--- a/libps/fmt.c
+++ b/libps/fmt.c
@@ -21,7 +21,7 @@
#include <stdio.h>
#include <stdlib.h>
-#include <assert.h>
+#include <assert-backtrace.h>
#include <string.h>
#include <ctype.h>
@@ -80,8 +80,8 @@ _fmt_create (char *src, int posix, struct ps_fmt_specs *fmt_specs,
if (fields == NULL)
{
- FREE (new_fmt);
FREE (new_fmt->src);
+ FREE (new_fmt);
return ENOMEM;
}
@@ -362,12 +362,9 @@ ps_fmt_clone (struct ps_fmt *fmt, struct ps_fmt **copy)
if (!new || !fields || !src)
{
- if (new)
- free (new);
- if (fields)
- free (fields);
- if (src)
- free (src);
+ free (new);
+ free (fields);
+ free (src);
return ENOMEM;
}
diff --git a/libps/host.c b/libps/host.c
index 9a46e0086..120e5c49d 100644
--- a/libps/host.c
+++ b/libps/host.c
@@ -21,7 +21,7 @@
#include <hurd.h>
#include <stdio.h>
#include <stdlib.h>
-#include <assert.h>
+#include <assert-backtrace.h>
#include "ps.h"
#include "common.h"
diff --git a/libps/proclist.c b/libps/proclist.c
index 9a4d6ed59..4e2174ac4 100644
--- a/libps/proclist.c
+++ b/libps/proclist.c
@@ -21,7 +21,7 @@
#include <hurd.h>
#include <stdio.h>
#include <stdlib.h>
-#include <assert.h>
+#include <assert-backtrace.h>
#include <string.h>
#include "ps.h"
@@ -63,14 +63,12 @@ proc_stat_list_clone (struct proc_stat_list *pp, struct proc_stat_list **copy)
if (!new || !procs)
{
- if (new)
- free (new);
- if (procs)
- free (procs);
+ free (new);
+ free (procs);
return ENOMEM;
}
- bcopy (pp->proc_stats, procs, pp->num_procs);
+ memcpy (procs, pp->proc_stats, sizeof *procs * pp->num_procs);
new->proc_stats = procs;
new->num_procs = pp->num_procs;
diff --git a/libps/procstat.c b/libps/procstat.c
index 9f488cd6e..f6420eea9 100644
--- a/libps/procstat.c
+++ b/libps/procstat.c
@@ -20,7 +20,7 @@
#include <hurd.h>
#include <stdio.h>
#include <stdlib.h>
-#include <assert.h>
+#include <assert-backtrace.h>
#include <string.h>
#include "ps.h"
@@ -224,12 +224,12 @@ merge_procinfo (struct proc_stat *ps, ps_flags_t need, ps_flags_t have)
/* There was old information, try merging it. */
if (have & PSTAT_TASK_BASIC)
/* Task info. */
- bcopy (&old_pi_hdr.taskinfo, &new_pi->taskinfo,
- sizeof (struct task_basic_info));
+ memcpy (&new_pi->taskinfo, &old_pi_hdr.taskinfo,
+ sizeof (struct task_basic_info));
if (have & PSTAT_TASK_EVENTS)
/* Event info. */
- bcopy (&old_pi_hdr.taskevents, &new_pi->taskevents,
- sizeof (struct task_events_info));
+ memcpy (&new_pi->taskevents, &old_pi_hdr.taskevents,
+ sizeof (struct task_events_info));
/* That's it for now. */
if (new_pi != ps->proc_info)
@@ -604,7 +604,7 @@ clone (void *src, size_t size)
{
void *dst = malloc (size);
if (dst)
- bcopy (src, dst, size);
+ memcpy (dst, src, size);
return dst;
}
diff --git a/libps/spec.c b/libps/spec.c
index d8188d6b6..5e540f870 100644
--- a/libps/spec.c
+++ b/libps/spec.c
@@ -21,7 +21,8 @@
#include <hurd.h>
#include <stdio.h>
#include <stdlib.h>
-#include <assert.h>
+#include <assert-backtrace.h>
+#define assert assert_backtrace
#include <pwd.h>
#include <hurd/resource.h>
#include <unistd.h>
@@ -880,7 +881,7 @@ ps_cmp_times (struct proc_stat *ps1, struct proc_stat *ps2,
tv1.tv_sec > tv2.tv_sec ? 1
: tv1.tv_sec < tv2.tv_sec ? -1
: tv1.tv_usec > tv2.tv_usec ? 1
- : tv2.tv_usec < tv2.tv_usec ? -1
+ : tv1.tv_usec < tv2.tv_usec ? -1
: 0;
}
@@ -1022,7 +1023,7 @@ specs_add_alias (struct ps_fmt_specs *specs,
exp->name = malloc (name_len + 1);
if (! exp->name)
return 0;
- bcopy ((char *)alias->name, (char *)exp->name, name_len);
+ memcpy ((char *)exp->name, (char *)alias->name, name_len);
((char *)exp->name)[name_len] = '\0';
/* Copy the rest of the fields from ALIAS, but defaulting to SRC. */
diff --git a/libps/tty.c b/libps/tty.c
index 3ab72ee8b..92f8f3e3b 100644
--- a/libps/tty.c
+++ b/libps/tty.c
@@ -22,7 +22,7 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
-#include <assert.h>
+#include <assert-backtrace.h>
#include <hurd/term.h>
#include "ps.h"
diff --git a/libps/user.c b/libps/user.c
index 0b87ace35..f5b7edc65 100644
--- a/libps/user.c
+++ b/libps/user.c
@@ -22,7 +22,7 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
-#include <assert.h>
+#include <assert-backtrace.h>
#include "ps.h"
#include "common.h"