mirror of
				https://gitlab.gnome.org/GNOME/glib.git
				synced 2025-10-31 16:32:18 +01:00 
			
		
		
		
	Merge branch 'scan-build-fixes' into 'main'
Fix various scan-build errors See merge request GNOME/glib!4866
This commit is contained in:
		| @@ -3991,7 +3991,12 @@ _resolve_dev_root (void) | ||||
|                     } | ||||
|                 } | ||||
|  | ||||
|               /* endmntent() calls fclose() for us, but scan-build doesn’t know that */ | ||||
| #if !G_ANALYZER_ANALYZING | ||||
|               endmntent (f); | ||||
| #else | ||||
|               fclose (f); | ||||
| #endif | ||||
|  | ||||
| #ifndef HAVE_GETMNTENT_R | ||||
| 	      G_UNLOCK (getmntent); | ||||
|   | ||||
| @@ -53,7 +53,7 @@ static gboolean | ||||
| write_out_typelib (gchar     *prefix, | ||||
|                    GITypelib *typelib) | ||||
| { | ||||
|   FILE *file; | ||||
|   FILE *file, *file_owned = NULL; | ||||
|   gsize written; | ||||
|   GFile *file_obj; | ||||
|   gchar *filename; | ||||
| @@ -86,7 +86,7 @@ write_out_typelib (gchar     *prefix, | ||||
|       file_obj = g_file_new_for_path (filename); | ||||
|       tmp_filename = g_strdup_printf ("%s.tmp", filename); | ||||
|       tmp_file_obj = g_file_new_for_path (tmp_filename); | ||||
|       file = g_fopen (tmp_filename, "wbe"); | ||||
|       file = file_owned = g_fopen (tmp_filename, "wbe"); | ||||
|  | ||||
|       if (file == NULL) | ||||
|         { | ||||
| @@ -106,8 +106,8 @@ write_out_typelib (gchar     *prefix, | ||||
|       goto out; | ||||
|     } | ||||
|  | ||||
|   if (output != NULL) | ||||
|     fclose (file); | ||||
|   if (file_owned != NULL) | ||||
|     fclose (g_steal_pointer (&file_owned)); | ||||
|   if (tmp_filename != NULL) | ||||
|     { | ||||
|       if (!g_file_move (tmp_file_obj, file_obj, G_FILE_COPY_OVERWRITE, NULL, NULL, NULL, &error)) | ||||
|   | ||||
| @@ -155,6 +155,13 @@ mapped_file_new_from_fd (int           fd, | ||||
|       file->contents = NULL; | ||||
|       return file; | ||||
|     } | ||||
|   else if (st.st_size == 0) | ||||
|     { | ||||
|       errno = EINVAL; | ||||
|       file->length = 0; | ||||
|       file->contents = MAP_FAILED; | ||||
|       goto error; | ||||
|     } | ||||
|  | ||||
|   file->contents = MAP_FAILED; | ||||
|  | ||||
| @@ -192,7 +199,7 @@ mapped_file_new_from_fd (int           fd, | ||||
|     } | ||||
| #endif | ||||
|  | ||||
|    | ||||
| error: | ||||
|   if (file->contents == MAP_FAILED) | ||||
|     { | ||||
|       if (error != NULL) | ||||
|   | ||||
| @@ -194,7 +194,7 @@ g_rand_new (void) | ||||
| 	      errno = 0; | ||||
| 	      r = fread (seed, sizeof (seed), 1, dev_urandom); | ||||
| 	    } | ||||
| 	  while G_UNLIKELY (errno == EINTR); | ||||
| 	  while G_UNLIKELY (r != 1 && errno == EINTR); | ||||
|  | ||||
| 	  if (r != 1) | ||||
| 	    dev_urandom_exists = FALSE; | ||||
|   | ||||
| @@ -917,9 +917,10 @@ do_exec (gint                  child_err_report_fd, | ||||
|                */ | ||||
|               if (target_fds[i] == child_err_report_fd) | ||||
|                 { | ||||
|                   child_err_report_fd = dupfd_cloexec (child_err_report_fd, max_target_fd + 1); | ||||
|                   if (child_err_report_fd < 0) | ||||
|                   int new_child_err_report_fd = dupfd_cloexec (child_err_report_fd, max_target_fd + 1); | ||||
|                   if (new_child_err_report_fd < 0) | ||||
|                     write_err_and_exit (child_err_report_fd, CHILD_DUPFD_FAILED); | ||||
|                   child_err_report_fd = new_child_err_report_fd; | ||||
|                 } | ||||
|  | ||||
|               if (safe_dup2 (source_fds[i], target_fds[i]) < 0) | ||||
|   | ||||
		Reference in New Issue
	
	Block a user