Skip to content

Commit 3a9d846

Browse files
authored
Merge pull request #120 from mephistolist/main
Fixing New Warnings.
2 parents 9117bc9 + d82467f commit 3a9d846

File tree

2 files changed

+13
-10
lines changed

2 files changed

+13
-10
lines changed

src/download.c

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,11 @@
1111
#include "libspm.h"
1212
#include "cutils.h"
1313

14-
int download(char* url, FILE* fp)
15-
{
14+
int download(char* url, FILE* fp) {
1615
CURL *curl = curl_easy_init();
17-
if(curl)
18-
{
16+
if(curl) {
1917
CURLcode res;
18+
(void) res;
2019
curl_easy_setopt(curl, CURLOPT_USERAGENT, "CCCP/1.0 (https://www.sovietlinux.org/)");
2120
curl_easy_setopt(curl, CURLOPT_FOLLOWLOCATION, 1);
2221
curl_easy_setopt(curl, CURLOPT_URL, url);
@@ -26,4 +25,4 @@ int download(char* url, FILE* fp)
2625
curl_easy_cleanup(curl);
2726
}
2827
return 0;
29-
}
28+
}

src/make.c

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
*/
2626
int make(char* package_dir, struct package* pkg) {
2727
char* build_dir = getenv("SOVIET_BUILD_DIR");
28+
(void)build_dir;
2829
char* make_dir = getenv("SOVIET_MAKE_DIR");
2930

3031
char* cmd_params;
@@ -44,7 +45,9 @@ int make(char* package_dir, struct package* pkg) {
4445
for (int i = 0; i < pkg->filesCount; i++)
4546
{
4647
int download_attempts = 3;
47-
int download_success = 0;
48+
(void)download_attempts;
49+
int download_success = 0;
50+
(void)download_success;
4851

4952
struct stat st_source = {0};
5053
struct stat st_source_loc = {0};
@@ -107,10 +110,11 @@ int make(char* package_dir, struct package* pkg) {
107110

108111
SHA256((unsigned char*) buffer, size, hash);
109112

110-
if (hash == NULL) {
113+
/* This caused and warning and functionally does nothing. Here hash is an array of unsigned char, but arrays in C are not pointers that can be NULL. This should probably be done with fread or fopen instead. Commenting out for now to silence the warning*/
114+
/*if (hash == NULL) {
111115
msg(FATAL, "Could not verify the file's hash");
112116
return -1;
113-
}
117+
}*/
114118

115119
dbg(1, "Hash is %s", file_sha256);
116120
for(int k = 0; k < SHA256_DIGEST_LENGTH; k++) {
@@ -136,8 +140,8 @@ int make(char* package_dir, struct package* pkg) {
136140
dbg(1, "Loading form %s", source_location);
137141
loadFile(source_file_location, location);
138142
}
139-
140-
free(files);
143+
144+
free(files);
141145
free(location);
142146
free(source_location);
143147
free(source_file_location);

0 commit comments

Comments
 (0)