Imported Upstream version 1.1.0
[platform/upstream/oprofile.git] / opjitconv / opjitconv.c
index fb38fb3..e28bd29 100644 (file)
@@ -216,7 +216,7 @@ int copy_dumpfile(char const * dumpfile, char * tmp_dumpfile)
        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_RDONLY);
        if (fd < 0) {
                perror("opjitconv failed to open JIT dumpfile");
                return OP_JIT_CONV_FAIL;
@@ -819,6 +819,7 @@ static int _process_args(int argc, char * const argv[])
 {
        int keep_trying = 1;
        int idx_of_non_options = 0;
+       char * prev_env = getenv("POSIXLY_CORRECT");
        setenv("POSIXLY_CORRECT", "1", 0);
        while (keep_trying) {
                int option_idx = 0;
@@ -853,6 +854,10 @@ static int _process_args(int argc, char * const argv[])
                        break;
                }
        }
+
+       if (prev_env == NULL)
+               unsetenv("POSIXLY_CORRECT");
+
        return idx_of_non_options;
 }