summaryrefslogtreecommitdiff
path: root/src/udev
diff options
context:
space:
mode:
authorKacper Kowalik (Xarthisius) <xarthisius@gentoo.org>2012-11-18 10:49:47 +0100
committerAnthony G. Basile <blueness@gentoo.org>2012-11-18 10:14:19 -0500
commitc189ab04cbaa2f011da0210f2c885e6f693f1d6c (patch)
treee013ea0467292d81b5318106985d3bfeec6a333f /src/udev
parent2af83cafa0f410edc1d60029edfd457e121114a4 (diff)
Fix unused result warnings
Signed-off-by: Anthony G. Basile <blueness@gentoo.org>
Diffstat (limited to 'src/udev')
-rw-r--r--src/udev/udev-node.c3
-rw-r--r--src/udev/udev-rules.c3
-rw-r--r--src/udev/udevadm-hwdb.c15
-rw-r--r--src/udev/udevadm-settle.c3
-rw-r--r--src/udev/udevd.c6
5 files changed, 21 insertions, 9 deletions
diff --git a/src/udev/udev-node.c b/src/udev/udev-node.c
index 7774303704..df3fac8ab6 100644
--- a/src/udev/udev-node.c
+++ b/src/udev/udev-node.c
@@ -282,7 +282,8 @@ static int node_fixup(struct udev_device *dev, mode_t mode, uid_t uid, gid_t gid
if ((stats.st_mode & 0777) != (mode & 0777) || stats.st_uid != uid || stats.st_gid != gid) {
log_debug("set permissions %s, %#o, uid=%u, gid=%u\n", devnode, mode, uid, gid);
chmod(devnode, mode);
- chown(devnode, uid, gid);
+ if (chown(devnode, uid, gid) < 0)
+ log_debug("Failed to change ownership of %s to uid=%u, gid=%u\n", devnode, uid, gid);
} else {
log_debug("preserve permissions %s, %#o, uid=%u, gid=%u\n", devnode, mode, uid, gid);
}
diff --git a/src/udev/udev-rules.c b/src/udev/udev-rules.c
index e6f0f5da7e..a85b41185f 100644
--- a/src/udev/udev-rules.c
+++ b/src/udev/udev-rules.c
@@ -2552,7 +2552,8 @@ void udev_rules_apply_static_dev_perms(struct udev_rules *rules)
}
if ((uid != 0 && uid != stats.st_uid) || (gid != 0 && gid != stats.st_gid)) {
- chown(filename, uid, gid);
+ if (chown(filename, uid, gid) < 0)
+ log_debug("Following chown failed!");
log_debug("chown '%s' %u %u\n", filename, uid, gid);
}
diff --git a/src/udev/udevadm-hwdb.c b/src/udev/udevadm-hwdb.c
index 02d8d01f8a..e545689f3d 100644
--- a/src/udev/udevadm-hwdb.c
+++ b/src/udev/udevadm-hwdb.c
@@ -313,12 +313,14 @@ static int64_t trie_store_nodes(struct trie_f *trie, struct trie_node *node) {
/* write node */
node_off = ftello(trie->f);
- fwrite(&n, sizeof(struct trie_node_f), 1, trie->f);
+ if (fwrite(&n, sizeof(struct trie_node_f), 1, trie->f) != 1)
+ log_error("Failed to write sizeof struct trie_node_f to n in %s\n", "[udevadm-hwdb.c:trie_store_nodes]");
trie->nodes_count++;
/* append children array */
if (node->children_count) {
- fwrite(children, sizeof(struct trie_child_entry_f), node->children_count, trie->f);
+ if (fwrite(children, sizeof(struct trie_child_entry_f), node->children_count, trie->f) != node->children_count)
+ log_error("Failed to write children_count in %s\n", "[udevadm-hwdb.c:trie_store_nodes]");
trie->children_count += node->children_count;
free(children);
}
@@ -330,7 +332,8 @@ static int64_t trie_store_nodes(struct trie_f *trie, struct trie_node *node) {
.value_off = htole64(trie->strings_off + node->values[i].value_off),
};
- fwrite(&v, sizeof(struct trie_value_entry_f), 1, trie->f);
+ if (fwrite(&v, sizeof(struct trie_value_entry_f), 1, trie->f) != 1)
+ log_error("Failed to write sizeof trie_value_entry_f to v in %s\n", "[udevadm-hwdb.c:trie_store_nodes]");
trie->values_count++;
}
@@ -372,14 +375,16 @@ static int trie_store(struct trie *trie, const char *filename) {
h.nodes_len = htole64(pos - sizeof(struct trie_header_f));
/* write string buffer */
- fwrite(trie->strings->buf, trie->strings->len, 1, t.f);
+ if (fwrite(trie->strings->buf, trie->strings->len, 1, t.f) != 1)
+ log_error("Failed to write into trie->strings->buf in %s\n", "[udevadm-hwdb.c:trie_store]");
h.strings_len = htole64(trie->strings->len);
/* write header */
size = ftello(t.f);
h.file_size = htole64(size);
fseeko(t.f, 0, SEEK_SET);
- fwrite(&h, sizeof(struct trie_header_f), 1, t.f);
+ if (fwrite(&h, sizeof(struct trie_header_f), 1, t.f) != 1)
+ log_error("Failed to write into h in %s\n", "[udevadm-hwdb.c:trie_store]");
err = ferror(t.f);
if (err)
err = -errno;
diff --git a/src/udev/udevadm-settle.c b/src/udev/udevadm-settle.c
index c4fc4ee4e5..dd833fb6db 100644
--- a/src/udev/udevadm-settle.c
+++ b/src/udev/udevadm-settle.c
@@ -192,7 +192,8 @@ static int adm_settle(struct udev *udev, int argc, char *argv[])
if (poll(pfd, 1, delay) > 0 && pfd[0].revents & POLLIN) {
char buf[sizeof(struct inotify_event) + PATH_MAX];
- read(pfd[0].fd, buf, sizeof(buf));
+ if (read(pfd[0].fd, buf, sizeof(buf)) == -1)
+ log_error("Failed to read buf in %s\n", "[udevadm-settle:adm_settle]");
}
} else {
sleep(1);
diff --git a/src/udev/udevd.c b/src/udev/udevd.c
index b9922f51dd..bd650a1f6b 100644
--- a/src/udev/udevd.c
+++ b/src/udev/udevd.c
@@ -1157,7 +1157,11 @@ int main(int argc, char *argv[])
}
/* set umask before creating any file/directory */
- chdir("/");
+ if (chdir("/") == -1) {
+ fprintf(stderr, "Cannot chdir to /\n");
+ log_error("Cannot chdir to /\n");
+ goto exit;
+ }
umask(022);
mkdir("/run/udev", 0755);