mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2024-12-26 15:36:14 +01:00
Merge branch 'coverity-fixes' into 'master'
glocalfile: Add an assertion to help static analysis See merge request GNOME/glib!1785
This commit is contained in:
commit
c3f613af0c
@ -2842,22 +2842,24 @@ g_local_file_measure_size_of_contents (gint fd,
|
|||||||
gboolean success = TRUE;
|
gboolean success = TRUE;
|
||||||
const gchar *name;
|
const gchar *name;
|
||||||
GDir *dir;
|
GDir *dir;
|
||||||
|
gint saved_errno;
|
||||||
|
|
||||||
#ifdef AT_FDCWD
|
#ifdef AT_FDCWD
|
||||||
{
|
{
|
||||||
/* If this fails, we want to preserve the errno from fopendir() */
|
/* If this fails, we want to preserve the errno from fdopendir() */
|
||||||
DIR *dirp;
|
DIR *dirp;
|
||||||
dirp = fdopendir (fd);
|
dirp = fdopendir (fd);
|
||||||
|
saved_errno = errno;
|
||||||
dir = dirp ? GLIB_PRIVATE_CALL(g_dir_new_from_dirp) (dirp) : NULL;
|
dir = dirp ? GLIB_PRIVATE_CALL(g_dir_new_from_dirp) (dirp) : NULL;
|
||||||
|
g_assert ((dirp == NULL) == (dir == NULL));
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
dir = GLIB_PRIVATE_CALL(g_dir_open_with_errno) (dir_name->data, 0);
|
dir = GLIB_PRIVATE_CALL(g_dir_open_with_errno) (dir_name->data, 0);
|
||||||
|
saved_errno = errno;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (dir == NULL)
|
if (dir == NULL)
|
||||||
{
|
{
|
||||||
gint saved_errno = errno;
|
|
||||||
|
|
||||||
#ifdef AT_FDCWD
|
#ifdef AT_FDCWD
|
||||||
close (fd);
|
close (fd);
|
||||||
#endif
|
#endif
|
||||||
|
@ -4289,7 +4289,7 @@ g_variant_format_string_scan (const gchar *string,
|
|||||||
const gchar *limit,
|
const gchar *limit,
|
||||||
const gchar **endptr)
|
const gchar **endptr)
|
||||||
{
|
{
|
||||||
#define next_char() (string == limit ? '\0' : *string++)
|
#define next_char() (string == limit ? '\0' : *(string++))
|
||||||
#define peek_char() (string == limit ? '\0' : *string)
|
#define peek_char() (string == limit ? '\0' : *string)
|
||||||
char c;
|
char c;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user