~posulliv/drizzle/memcached_applier

« back to all changes in this revision

Viewing changes to client/drizzleslap.cc

Merged trunk and resolved conflicts.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1331
1331
    }
1332
1332
    else
1333
1333
    {
1334
 
      if ((csv_file= my_open(opt_csv_str, O_CREAT|O_WRONLY|O_APPEND, MYF(0)))
1335
 
          == -1)
 
1334
      if ((csv_file= open(opt_csv_str, O_CREAT|O_WRONLY|O_APPEND, 
 
1335
                          S_IRUSR|S_IWUSR|S_IRGRP|S_IROTH)) == -1)
1336
1336
      {
1337
1337
        fprintf(stderr,"%s: Could not open csv file: %sn\n",
1338
1338
                my_progname, opt_csv_str);
1543
1543
                my_progname);
1544
1544
        exit(1);
1545
1545
      }
1546
 
      if ((data_file= my_open(create_string, O_RDWR, MYF(0))) == -1)
 
1546
      if ((data_file= open(create_string, O_RDWR)) == -1)
1547
1547
      {
1548
1548
        fprintf(stderr,"%s: Could not open create file\n", my_progname);
1549
1549
        exit(1);
1600
1600
                my_progname);
1601
1601
        exit(1);
1602
1602
      }
1603
 
      if ((data_file= my_open(user_supplied_query, O_RDWR, MYF(0))) == -1)
 
1603
      if ((data_file= open(user_supplied_query, O_RDWR)) == -1)
1604
1604
      {
1605
1605
        fprintf(stderr,"%s: Could not open query supplied file\n", my_progname);
1606
1606
        exit(1);
1647
1647
              my_progname);
1648
1648
      exit(1);
1649
1649
    }
1650
 
    if ((data_file= my_open(user_supplied_pre_statements, O_RDWR, MYF(0))) == -1)
 
1650
    if ((data_file= open(user_supplied_pre_statements, O_RDWR)) == -1)
1651
1651
    {
1652
1652
      fprintf(stderr,"%s: Could not open query supplied file\n", my_progname);
1653
1653
      exit(1);
1694
1694
              my_progname);
1695
1695
      exit(1);
1696
1696
    }
1697
 
    if ((data_file= my_open(user_supplied_post_statements, O_RDWR, MYF(0))) == -1)
 
1697
    if ((data_file= open(user_supplied_post_statements, O_RDWR)) == -1)
1698
1698
    {
1699
1699
      fprintf(stderr,"%s: Could not open query supplied file\n", my_progname);
1700
1700
      exit(1);
2417
2417
  uint32_t length= strlen(script);
2418
2418
  uint32_t count= 0; /* We know that there is always one */
2419
2419
 
2420
 
  for (tmp= *sptr= (statement *)malloc(sizeof(statement));
 
2420
  for (tmp= *sptr= (statement *)calloc(1, sizeof(statement));
2421
2421
       (retstr= strchr(ptr, delm));
2422
 
       tmp->next=  (statement *)malloc(sizeof(statement)),
 
2422
       tmp->next=  (statement *)calloc(1, sizeof(statement)),
2423
2423
       tmp= tmp->next)
2424
2424
  {
2425
 
    memset(tmp, 0, sizeof(statement));
 
2425
    if (tmp == NULL)
 
2426
    {
 
2427
      fprintf(stderr,"Error allocating memory while parsing delimiter\n");
 
2428
      exit(1);
 
2429
    }
 
2430
 
2426
2431
    count++;
2427
2432
    tmp->length= (size_t)(retstr - ptr);
2428
2433
    tmp->string= (char *)malloc(tmp->length + 1);
 
2434
 
2429
2435
    if (tmp->string == NULL)
2430
2436
    {
2431
2437
      fprintf(stderr,"Error allocating memory while parsing delimiter\n");
2432
2438
      exit(1);
2433
2439
    }
 
2440
 
2434
2441
    memcpy(tmp->string, ptr, tmp->length);
2435
2442
    tmp->string[tmp->length]= 0;
2436
2443
    ptr+= retstr - ptr + 1;