summaryrefslogtreecommitdiff
path: root/media-radio/xlog/files/xlog-2.0.24-musl.patch
blob: a235f37e45dc4ac198b477913e2b597b0a0145f0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
Avoid assignment to read only stderr variable 
Bug #832236
diff --git a/src/gui_tracedialog.c b/src/gui_tracedialog.c
index a00020e..52b6c76 100644
--- a/src/gui_tracedialog.c
+++ b/src/gui_tracedialog.c
@@ -32,6 +32,7 @@
 #include <unistd.h>
 #include <glib/gstdio.h>
 #include <hamlib/rig.h>
+#include <fcntl.h>
 
 #include "gui_tracedialog.h"
 #include "gui_warningdialog.h"
@@ -43,7 +44,7 @@ typedef struct
 {
 	time_t modified;		/* Last Modified Time */				
 	gchar *filename;		/* File Name */
-	FILE *fd;				/* File Descriptor */
+	gint filedesc;			/* File Descriptor */
 	unsigned long filesize; /* File Size */
 } fileinfo;
 
@@ -62,14 +63,9 @@ stop_tracing (void)
 
 	stop_hamlib ();
 	g_source_remove (tracetimer);
-	fclose (finfo.fd);
+	close(finfo.filedesc);
 	dup2 (saved_fd, STDERR_FILENO);
 	close (saved_fd);
-#ifndef __NetBSD__
-#ifndef G_OS_WIN32
-	stderr = fdopen (STDERR_FILENO, "w");
-#endif
-#endif
 	hamlibresult = start_hamlib (preferences.rigid, preferences.device,
 		RIG_DEBUG_NONE, preferences.polltime);
 }
@@ -180,7 +176,10 @@ on_trace_hamlib_activate(GtkMenuItem * menuitem, gpointer user_data)
 			(GTK_BOX (vbox), tracelabel, FALSE, FALSE, 0);
 		g_free (tracestr);
 		stop_hamlib();
-		finfo.fd = freopen (finfo.filename, "w", stderr);
+	 	finfo.filedesc = open(finfo.filename, O_WRONLY|O_CREAT, 0644);
+		if (finfo.filedesc >= 0) {
+			dup2 (finfo.filedesc, STDERR_FILENO); 
+		}
 		hamlibresult = start_hamlib (preferences.rigid, preferences.device, 
 			RIG_DEBUG_TRACE, preferences.polltime);
 		tracetimer = g_timeout_add