[IIO] open file with with glib function
authorJaeyun <jy1210.jung@samsung.com>
Tue, 30 Apr 2019 10:31:29 +0000 (19:31 +0900)
committerMyungJoo Ham <myungjoo.ham@samsung.com>
Wed, 8 May 2019 03:57:36 +0000 (12:57 +0900)
Use glib function to open file (fix one of security issues)

Signed-off-by: Jaeyun Jung <jy1210.jung@samsung.com>
gst/nnstreamer/tensor_source/tensor_src_iio.c

index 712d261..a4075f9 100644 (file)
@@ -80,6 +80,7 @@
 #include <gst/gstinfo.h>
 #include <gst/gst.h>
 #include <glib.h>
+#include <glib/gstdio.h>
 #include <string.h>
 #include <endian.h>
 #include <fcntl.h>
@@ -1303,7 +1304,7 @@ gst_tensor_write_sysfs_string (GstTensorSrcIIO * self, const gchar * file,
   GError *error = NULL;
 
   filename = g_build_filename (base_dir, file, NULL);
-  fd = fopen (filename, "w");
+  fd = g_fopen (filename, "w");
   if (fd == NULL) {
     GST_ERROR_OBJECT (self, "Unable to open file to write %s.\n", filename);
     goto error_free_filename;