[glib: 8/11] Fix redefinition of local variable and non-initialized variable in gio/glocalfileoutputstream.c
- From: Philip Withnall <pwithnall src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [glib: 8/11] Fix redefinition of local variable and non-initialized variable in gio/glocalfileoutputstream.c
- Date: Thu, 17 Mar 2022 15:13:17 +0000 (UTC)
commit d0dfc765540eabf26d95fb4b05a450082cd53d9e
Author: Loic Le Page <llepage fluendo com>
Date: Wed Jan 19 19:38:41 2022 +0100
Fix redefinition of local variable and non-initialized variable in gio/glocalfileoutputstream.c
gio/glocalfileoutputstream.c | 14 ++++++++------
1 file changed, 8 insertions(+), 6 deletions(-)
---
diff --git a/gio/glocalfileoutputstream.c b/gio/glocalfileoutputstream.c
index 71a992668..5d6a48840 100644
--- a/gio/glocalfileoutputstream.c
+++ b/gio/glocalfileoutputstream.c
@@ -855,7 +855,7 @@ handle_overwrite_open (const char *filename,
int open_flags;
int res;
int mode;
- int errsv;
+ int errsv = 0;
gboolean replace_destination_set = (flags & G_FILE_CREATE_REPLACE_DESTINATION);
mode = mode_from_flags_or_info (flags, reference_info);
@@ -1179,7 +1179,7 @@ handle_overwrite_open (const char *filename,
/* Seek back to the start of the file after the backup copy */
if (lseek (fd, 0, SEEK_SET) == -1)
{
- int errsv = errno;
+ errsv = errno;
g_set_error (error, G_IO_ERROR,
g_io_error_from_errno (errsv),
@@ -1195,7 +1195,7 @@ handle_overwrite_open (const char *filename,
if (g_unlink (filename) != 0)
{
- int errsv = errno;
+ errsv = errno;
g_set_error (error, G_IO_ERROR,
g_io_error_from_errno (errsv),
@@ -1211,8 +1211,10 @@ handle_overwrite_open (const char *filename,
fd = g_open (filename, open_flags, mode);
if (fd == -1)
{
- int errsv = errno;
- char *display_name = g_filename_display_name (filename);
+ char *display_name;
+ errsv = errno;
+ display_name = g_filename_display_name (filename);
+
g_set_error (error, G_IO_ERROR,
g_io_error_from_errno (errsv),
_("Error opening file ā%sā: %s"),
@@ -1230,7 +1232,7 @@ handle_overwrite_open (const char *filename,
if (ftruncate (fd, 0) == -1)
#endif
{
- int errsv = errno;
+ errsv = errno;
g_set_error (error, G_IO_ERROR,
g_io_error_from_errno (errsv),
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]