Skip to content

Commit 96eed20

Browse files
committed
bin/xbps-create: replace more asserts with error handling
1 parent 7277357 commit 96eed20

1 file changed

Lines changed: 6 additions & 3 deletions

File tree

bin/xbps-create/main.c

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -276,7 +276,8 @@ process_dict_of_arrays(const char *key UNUSED, const char *val)
276276
return;
277277

278278
args = strdup(val);
279-
assert(args);
279+
if (!args)
280+
die("strdup");
280281

281282
if (strchr(args, ' ') == NULL) {
282283
altgrname = strtok(args, ":");
@@ -409,7 +410,8 @@ ftw_cb(const char *fpath, const struct stat *sb, const struct dirent *dir UNUSED
409410
xbps_dictionary_set_cstring(fileinfo, "file", filep);
410411
xbps_dictionary_set(all_filesd, fpath, fileinfo);
411412
xe->file = strdup(fpath);
412-
assert(xe->file);
413+
if (!xe->file)
414+
die("strdup");
413415

414416
if ((strcmp(fpath, "./INSTALL") == 0) ||
415417
(strcmp(fpath, "./REMOVE") == 0)) {
@@ -495,7 +497,8 @@ ftw_cb(const char *fpath, const struct stat *sb, const struct dirent *dir UNUSED
495497
die("xbps_sanitize_path");
496498
xbps_dictionary_set_cstring(fileinfo, "target", xe->target);
497499
}
498-
assert(xbps_dictionary_get(fileinfo, "target"));
500+
if (!xbps_dictionary_get(fileinfo, "target"))
501+
xbps_unreachable();
499502
} else if (S_ISREG(sb->st_mode)) {
500503
struct xentry *xep;
501504
bool hlink = false;

0 commit comments

Comments
 (0)