[prev in list] [next in list] [prev in thread] [next in thread] 

List:       oprofile-list
Subject:    [PATCH] opjitconv: Fix incorrect open() flag
From:       Richard Purdie <richard.purdie () linuxfoundation ! org>
Date:       2014-11-07 12:32:14
Message-ID: 1415363534.30499.7.camel () linuxfoundation ! org
[Download RAW message or body]

When using compile fortification options on a mips build we saw:

> In file included from \
> /media/build1/poky/build/tmp/sysroots/qemumips/usr/include/fcntl.h:302:0,
> from opjitconv.c:25:
> In function 'open',
> inlined from 'copy_dumpfile' at opjitconv.c:219:6:
> /media/build1/poky/build/tmp/sysroots/qemumips/usr/include/bits/fcntl2.h:50:4: \
> error: call to '__open_missing_mode' declared with attribute error: open with \
> O_CREAT in second argument needs 3 arguments
> __open_missing_mode ();
> ^
> Makefile:440: recipe for target 'opjitconv.o' failed

Why does this only happen on mips? mips has:

O_CREAT = 0x100 and S_IRUSR = 0400 and these (in hex and otcal) are equivalent. 
Most other platforms have O_CREAT = 0100.

Obviously the call is simply wrong so fix it...

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>

Index: oprofile-1.0.0/opjitconv/opjitconv.c
===================================================================
--- oprofile-1.0.0.orig/opjitconv/opjitconv.c	2014-09-12 14:39:47.000000000 +0000
+++ oprofile-1.0.0/opjitconv/opjitconv.c	2014-11-06 13:14:25.941639003 +0000
@@ -216,7 +216,7 @@
 	int file_locked = 0;
 	unsigned int usecs_waited = 0;
 	int rc = OP_JIT_CONV_OK;
-	int fd = open(dumpfile, S_IRUSR);
+	int fd = open(dumpfile, O_CREAT, S_IRUSR|S_IWUSR);
 	if (fd < 0) {
 		perror("opjitconv failed to open JIT dumpfile");
 		return OP_JIT_CONV_FAIL;


------------------------------------------------------------------------------
_______________________________________________
oprofile-list mailing list
oprofile-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/oprofile-list


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic