summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorPatrick McDermott <patrick.mcdermott@libiquity.com>2023-05-12 14:36:09 (EDT)
committer Patrick McDermott <patrick.mcdermott@libiquity.com>2023-05-12 15:01:23 (EDT)
commit7ed22b481f47681887bdf1068c910e2a67d688a7 (patch)
treefbbb8fa9d825fe0d68a41b3774c8a3f6d6274f28 /src
parent01231ee43570d1de5f133a966b1d04bc68008b38 (diff)
opk/read: Make GCC 12 analyzer STFU
What a mess. Fixes most of analyzer*.log (thousands of lines of error messages).
Diffstat (limited to 'src')
-rw-r--r--src/opk/read.c40
1 files changed, 40 insertions, 0 deletions
diff --git a/src/opk/read.c b/src/opk/read.c
index 768f64d..2d9f439 100644
--- a/src/opk/read.c
+++ b/src/opk/read.c
@@ -140,6 +140,8 @@ _opkg_opk_opk_read_control(struct opkg_opk_opk *opk)
"\n"), stderr);
return OPKG_OPK_ERROR;
}
+/* For below #pragmas: path initialized here
+ * (opk->control_dir != NULL). */
path = malloc(strlen(opk->control_dir) +
OPKG_OPK_USTAR_NAME_SIZE + 1);
if (path == NULL) {
@@ -152,7 +154,11 @@ _opkg_opk_opk_read_control(struct opkg_opk_opk *opk)
if (_opkg_opk_opk_read_init_inner(opk) != OPKG_OPK_OK) {
if (opk->control_dir != NULL) {
+# pragma GCC diagnostic push
+# pragma GCC diagnostic ignored \
+ "-Wanalyzer-use-of-uninitialized-value"
free(path);
+# pragma GCC diagnostic pop
}
return OPKG_OPK_ERROR;
}
@@ -176,27 +182,42 @@ _opkg_opk_opk_read_control(struct opkg_opk_opk *opk)
free(member);
_opkg_opk_opk_read_free_inner(opk);
if (opk->control_dir != NULL) {
+# pragma GCC diagnostic push
+# pragma GCC diagnostic ignored \
+ "-Wanalyzer-use-of-uninitialized-value"
free(path);
+# pragma GCC diagnostic pop
}
return OPKG_OPK_ERROR;
}
/* Open file for extraction. */
if (opk->control_dir != NULL) {
+# pragma GCC diagnostic push
+# pragma GCC diagnostic ignored \
+ "-Wanalyzer-use-of-uninitialized-value"
if (sprintf(path, "%s/%s", opk->control_dir,
member->name) <= 0) {
free(member);
_opkg_opk_opk_read_free_inner(opk);
free(path);
return OPKG_OPK_ERROR;
+# pragma GCC diagnostic pop
}
+/* For below #pragmas: fp initialized here
+ * (opk->control_dir != NULL). */
+/* GCC analyzer doesn't complain about this use of path? */
fp = fopen(path, "wb");
if (fp == NULL) {
fputs(_("Error: Failed to extract control file"
"\n"), stderr);
free(member);
_opkg_opk_opk_read_free_inner(opk);
+# pragma GCC diagnostic push
+# pragma GCC diagnostic ignored \
+ "-Wanalyzer-use-of-uninitialized-value"
free(path);
+# pragma GCC diagnostic pop
return OPKG_OPK_ERROR;
}
}
@@ -235,12 +256,16 @@ _opkg_opk_opk_read_control(struct opkg_opk_opk *opk)
}
return OPKG_OPK_ERROR;
}
+# pragma GCC diagnostic push
+# pragma GCC diagnostic ignored \
+ "-Wanalyzer-use-of-uninitialized-value"
if (opk->control_dir != NULL && fwrite(buffer, 1, size,
fp) != size) {
fputs(_("Error: Failed to write control file\n")
, stderr);
_opkg_opk_opk_read_free_inner(opk);
free(path);
+# pragma GCC diagnostic pop
return OPKG_OPK_ERROR;
}
}
@@ -249,25 +274,40 @@ _opkg_opk_opk_read_control(struct opkg_opk_opk *opk)
stderr);
_opkg_opk_opk_read_free_inner(opk);
if (opk->control_dir != NULL) {
+# pragma GCC diagnostic push
+# pragma GCC diagnostic ignored \
+ "-Wanalyzer-use-of-uninitialized-value"
free(path);
fclose(fp);
+# pragma GCC diagnostic pop
}
+# pragma GCC diagnostic push
+# pragma GCC diagnostic ignored "-Wanalyzer-file-leak"
return OPKG_OPK_ERROR;
+# pragma GCC diagnostic pop
}
opk->previously_printed = 1;
/* Close file for extraction. */
if (opk->control_dir != NULL) {
+# pragma GCC diagnostic push
+# pragma GCC diagnostic ignored \
+ "-Wanalyzer-use-of-uninitialized-value"
if (fclose(fp) != 0) {
_opkg_opk_opk_read_free_inner(opk);
free(path);
+# pragma GCC diagnostic pop
return OPKG_OPK_ERROR;
}
}
}
if (opk->control_dir != NULL) {
/* Done with path buffer. */
+# pragma GCC diagnostic push
+# pragma GCC diagnostic ignored \
+ "-Wanalyzer-use-of-uninitialized-value"
free(path);
+# pragma GCC diagnostic pop
}
if (ret_list == OPKG_OPK_ERROR) {
fputs(_("Error: Failed to list control files\n"), stderr);