chiark
/
gitweb
/
~ianmdlvl
/
elogind.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
0f0e240
)
udev: make sure we always return a valid error code in trie_store()
author
Lennart Poettering
<lennart@poettering.net>
Wed, 19 Feb 2014 16:51:08 +0000
(17:51 +0100)
committer
Lennart Poettering
<lennart@poettering.net>
Wed, 19 Feb 2014 16:53:50 +0000
(17:53 +0100)
src/udev/udevadm-hwdb.c
patch
|
blob
|
history
diff --git
a/src/udev/udevadm-hwdb.c
b/src/udev/udevadm-hwdb.c
index 16abbe8d2f3b29349d43c5670029a5ecec6fa609..65cbf618656a970ec447b2eed276625a77753c0c 100644
(file)
--- a/
src/udev/udevadm-hwdb.c
+++ b/
src/udev/udevadm-hwdb.c
@@
-341,7
+341,7
@@
static int trie_store(struct trie *trie, const char *filename) {
struct trie_f t = {
.trie = trie,
};
struct trie_f t = {
.trie = trie,
};
-
char *filename_tmp
;
+
_cleanup_free_ char *filename_tmp = NULL
;
int64_t pos;
int64_t root_off;
int64_t size;
int64_t pos;
int64_t root_off;
int64_t size;
@@
-385,8
+385,8
@@
static int trie_store(struct trie *trie, const char *filename) {
err = -errno;
fclose(t.f);
if (err < 0 || rename(filename_tmp, filename) < 0) {
err = -errno;
fclose(t.f);
if (err < 0 || rename(filename_tmp, filename) < 0) {
- unlink(filename_tmp);
-
goto out
;
+ unlink
_noerrno
(filename_tmp);
+
return err < 0 ? err : -errno
;
}
log_debug("=== trie on-disk ===");
}
log_debug("=== trie on-disk ===");
@@
-400,9
+400,8
@@
static int trie_store(struct trie *trie, const char *filename) {
t.values_count * sizeof(struct trie_value_entry_f), t.values_count);
log_debug("string store: %8zu bytes", trie->strings->len);
log_debug("strings start: %8"PRIu64, t.strings_off);
t.values_count * sizeof(struct trie_value_entry_f), t.values_count);
log_debug("string store: %8zu bytes", trie->strings->len);
log_debug("strings start: %8"PRIu64, t.strings_off);
-out:
- free(filename_tmp);
- return err;
+
+ return 0;
}
static int insert_data(struct trie *trie, struct udev_list *match_list,
}
static int insert_data(struct trie *trie, struct udev_list *match_list,