#include <string.h>
#include <stdlib.h>
#include <unistd.h>
-#include <lustre/lustre_user.h>
+#include <linux/lustre/lustre_user.h>
typedef struct flag_mapping {
const char *string;
while ((c = getopt (argc, argv, "f:m:")) != -1) {
switch (c) {
case 'f': {
- char *tmp;
+ char *tmp;
- cloned_flags = (char *)malloc(strlen(optarg)+1);
- if (cloned_flags == NULL) {
- fprintf(stderr, "Insufficient memory.\n");
- save_errno = -1;
- goto out;
- }
+ cloned_flags = strdup(optarg);
+ if (cloned_flags == NULL) {
+ fprintf(stderr, "Insufficient memory.\n");
+ save_errno = -1;
+ goto out;
+ }
- strncpy(cloned_flags, optarg, strlen(optarg)+1);
flags = atoi(cloned_flags);
if (flags > 0) {
flag_set = 1;