summaryrefslogtreecommitdiff
path: root/src/udev/collect/collect.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/udev/collect/collect.c')
-rw-r--r--src/udev/collect/collect.c20
1 files changed, 10 insertions, 10 deletions
diff --git a/src/udev/collect/collect.c b/src/udev/collect/collect.c
index 3c46e40de1..f95ee23b75 100644
--- a/src/udev/collect/collect.c
+++ b/src/udev/collect/collect.c
@@ -35,8 +35,8 @@
#include "libudev-private.h"
#include "macro.h"
-#define BUFSIZE 16
-#define UDEV_ALARM_TIMEOUT 180
+#define BUFSIZE 16
+#define UDEV_ALARM_TIMEOUT 180
enum collect_state {
STATE_NONE,
@@ -139,12 +139,12 @@ static int checkout(int fd)
restart:
len = bufsize >> 1;
- buf = calloc(1,bufsize + 1);
- if (!buf) {
- fprintf(stderr, "Out of memory.\n");
+ buf = malloc(bufsize + 1);
+ if (!buf)
return log_oom();
- }
memset(buf, ' ', bufsize);
+ buf[bufsize] = '\0';
+
ptr = buf + len;
while ((read(fd, buf + len, len)) > 0) {
while (ptr && *ptr) {
@@ -213,7 +213,7 @@ static void invite(char *us)
udev_list_node_foreach(him_node, &bunch) {
struct _mate *him = node_to_mate(him_node);
- if (!strcmp(him->name, us)) {
+ if (streq(him->name, us)) {
him->state = STATE_CONFIRMED;
who = him;
}
@@ -241,7 +241,7 @@ static void reject(char *us)
udev_list_node_foreach(him_node, &bunch) {
struct _mate *him = node_to_mate(him_node);
- if (!strcmp(him->name, us)) {
+ if (streq(him->name, us)) {
him->state = STATE_NONE;
who = him;
}
@@ -414,7 +414,7 @@ int main(int argc, char **argv)
if (debug)
fprintf(stderr, "Using checkpoint '%s'\n", checkpoint);
- util_strscpyl(tmpdir, sizeof(tmpdir), "/run/udev/collect", NULL);
+ strscpyl(tmpdir, sizeof(tmpdir), "/run/udev/collect", NULL);
fd = prepare(tmpdir, checkpoint);
if (fd < 0) {
ret = 3;
@@ -434,7 +434,7 @@ int main(int argc, char **argv)
udev_list_node_foreach(him_node, &bunch) {
struct _mate *him = node_to_mate(him_node);
- if (!strcmp(him->name, argv[i]))
+ if (streq(him->name, argv[i]))
who = him;
}
if (!who) {