Re: [PATCH] opjitconv: Fix incorrect open() flag
Maynard Johnson <[email protected]>
| Newsgroups | gmane.linux.oprofile |
|---|---|
| Message-ID | <[email protected]> |
Hi, Richard. Good to hear from you again. On 11/07/2014 06:32 AM, Richard Purdie wrote: > 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... Agreed that the open call is wrong, but the error is that the S_IRUSR create mode was specified instead of the O_RDONLY flag. The dumpfile should *not* be created if it does not exist. -Maynard > > Signed-off-by: Richard Purdie <[email protected]> > > 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 > [email protected] > https://lists.sourceforge.net/lists/listinfo/oprofile-list > ------------------------------------------------------------------------------