open misses a param



Hi,

open with O_CREAT needs three parameter but I case in this case, you
only want to open it for reading and not create it if it exists, so I
propose the following patch.

Andreas

--- mi-perfctr.c
+++ mi-perfctr.c
@@ -94,7 +94,7 @@

        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)) < 0) {
                mi_perror ("Error opening /proc/self/perfctr");
                goto bail;
        }

-- 
 Andreas Jaeger, Director Platform / openSUSE, aj suse de
  SUSE LINUX Products GmbH, GF: Markus Rex, HRB 16746 (AG Nürnberg)
   Maxfeldstr. 5, 90409 Nürnberg, Germany
    GPG fingerprint = 93A3 365E CE47 B889 DF7F  FED1 389A 563C C272 A126

Attachment: pgpr9caq4PQCg.pgp
Description: PGP signature



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