Merge branch 'coverity-return-values' into 'master'

Fix minor Coverity return value warnings

See merge request GNOME/glib!1748
This commit is contained in:
Sebastian Dröge
2020-11-13 15:24:47 +00:00
2 changed files with 6 additions and 3 deletions

View File

@@ -10,6 +10,7 @@ int
main (int argc, char **argv) main (int argc, char **argv)
{ {
FILE *f; FILE *f;
long tell_result;
size_t n_read, len; size_t n_read, len;
unsigned char *buf; unsigned char *buf;
@@ -19,7 +20,9 @@ main (int argc, char **argv)
f = fopen (argv[1], "r"); f = fopen (argv[1], "r");
assert (f); assert (f);
fseek (f, 0, SEEK_END); fseek (f, 0, SEEK_END);
len = ftell (f); tell_result = ftell (f);
assert (tell_result >= 0);
len = (size_t) tell_result;
fseek (f, 0, SEEK_SET); fseek (f, 0, SEEK_SET);
buf = (unsigned char*) malloc (len); buf = (unsigned char*) malloc (len);
n_read = fread (buf, 1, len, f); n_read = fread (buf, 1, len, f);

View File

@@ -1297,8 +1297,8 @@ rm_rf (const gchar *path)
dir = g_dir_open (path, 0, NULL); dir = g_dir_open (path, 0, NULL);
if (dir == NULL) if (dir == NULL)
{ {
/* Assume its a file. */ /* Assume its a file. Ignore failure. */
g_remove (path); (void) g_remove (path);
return; return;
} }