mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2025-08-11 19:54:05 +02:00
Merge branch 'coverity-return-values' into 'master'
Fix minor Coverity return value warnings See merge request GNOME/glib!1748
This commit is contained in:
@@ -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);
|
||||||
|
@@ -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 it’s a file. */
|
/* Assume it’s a file. Ignore failure. */
|
||||||
g_remove (path);
|
(void) g_remove (path);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user