[memprof: 2/76] mi-perfctr.c: Fix compilation with fortitfy enabled compiler



commit bb68e8b181a81da6a68277d7120609b23af7eb79
Author: Holger Hans Peter Freyther <zecke selfish org>
Date:   Thu Jun 4 12:16:38 2009 +0200

    mi-perfctr.c: Fix compilation with fortitfy enabled compiler
    
    Using O_CREAT in open requires a third argument with the mode_t,
    use a sane default even for a prc file...

 mi-perfctr.c |    6 +++++-
 1 files changed, 5 insertions(+), 1 deletions(-)
---
diff --git a/mi-perfctr.c b/mi-perfctr.c
index fa6d9f7..a48eff3 100644
--- a/mi-perfctr.c
+++ b/mi-perfctr.c
@@ -25,6 +25,9 @@
 #include <signal.h>
 #include <string.h>
 #include <sys/ioctl.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <fcntl.h>
 #include <ucontext.h>
 #include <unistd.h>
 
@@ -94,7 +97,8 @@ mi_perfctr_start (int interval)
 	
 	MI_DEBUG (("Turning on performance monitoring timer support\n"));
 
-	if ((perfctr_fd = open ("/proc/self/perfctr", O_RDONLY | O_CREAT)) < 0) {
+	if ((perfctr_fd = open ("/proc/self/perfctr", O_RDONLY | O_CREAT,
+				S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH)) < 0) {
 		mi_perror ("Error opening /proc/self/perfctr");
 		goto bail;
 	}



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]