Whamcloud - gitweb
b=12797
[fs/lustre-release.git] / lustre / tests / openfile.c
index 1510c8f..6cba76b 100644 (file)
@@ -7,7 +7,9 @@
 #endif
 
 /* for O_DIRECTORY and O_DIRECT */
+#ifndef _GNU_SOURCE
 #define _GNU_SOURCE
+#endif
 
 #include <stdio.h>
 #include <sys/types.h>
@@ -81,7 +83,7 @@ int main(int argc, char** argv)
                         }
 
                         strncpy(cloned_flags, optarg, strlen(optarg)+1);
-                        for (tmp = strtok(optarg, ":|"); tmp;
+                        for (tmp = strtok(cloned_flags, ":|"); tmp;
                              tmp = strtok(NULL, ":|")) {
                                 int i = 0;
 #ifdef DEBUG
@@ -101,6 +103,7 @@ int main(int argc, char** argv)
                                         exit(-1);
                                 }
                         }
+                        free(cloned_flags);
 #ifdef DEBUG
                         printf("flags = %x\n", flags);
 #endif