~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to client/drizzleslap.cc

  • Committer: Monty Taylor
  • Date: 2009-01-30 06:21:54 UTC
  • mto: (779.7.3 devel)
  • mto: This revision was merged to the branch mainline in revision 823.
  • Revision ID: mordred@inaugust.com-20090130062154-ix999h8nnh5z230i
Fixed solaris fixes for linux. Oh, and I also seem to have fixed some more configure stuff.

Show diffs side-by-side

added added

removed removed

Lines of Context:
99
99
static char *shared_memory_base_name=0;
100
100
#endif
101
101
 
 
102
extern "C"
 
103
bool get_one_option(int optid, const struct my_option *, char *argument);
 
104
 
102
105
/* Global Thread counter */
103
106
uint thread_counter;
104
107
pthread_mutex_t counter_mutex;
731
734
  my_print_help(my_long_options);
732
735
}
733
736
 
734
 
extern "C"
735
 
static bool
736
 
get_one_option(int optid, const struct my_option *, char *argument)
 
737
bool get_one_option(int optid, const struct my_option *, char *argument)
737
738
{
738
739
  char *endchar= NULL;
739
740
  uint64_t temp_drizzle_port= 0;
1285
1286
  struct stat sbuf;
1286
1287
  option_string *sql_type;
1287
1288
  unsigned int sql_type_count= 0;
 
1289
  ssize_t bytes_read= 0;
1288
1290
 
1289
1291
 
1290
1292
  if ((ho_error= handle_options(argc, argv, my_long_options, get_one_option)))
1555
1557
        fprintf(stderr,"%s: Could not open create file\n", my_progname);
1556
1558
        exit(1);
1557
1559
      }
1558
 
      if (sbuf.st_size + 1 > SIZE_MAX)
 
1560
      if ((uint64_t)(sbuf.st_size + 1) > SIZE_MAX)
1559
1561
      {
1560
1562
        fprintf(stderr, "Request for more memory than architecture supports\n");
1561
1563
        exit(1);
1567
1569
        exit(1);
1568
1570
      }
1569
1571
      memset(tmp_string, 0, (size_t)(sbuf.st_size + 1));
1570
 
      read(data_file, (unsigned char*) tmp_string, (size_t)sbuf.st_size);
 
1572
      bytes_read= read(data_file, (unsigned char*) tmp_string,
 
1573
                       (size_t)sbuf.st_size);
1571
1574
      tmp_string[sbuf.st_size]= '\0';
1572
1575
      close(data_file);
 
1576
      if (bytes_read != sbuf.st_size)
 
1577
      {
 
1578
        fprintf(stderr, "Problem reading file: read less bytes than requested\n");
 
1579
      }
1573
1580
      parse_delimiter(tmp_string, &create_statements, delimiter[0]);
1574
1581
      free(tmp_string);
1575
1582
    }
1607
1614
        fprintf(stderr,"%s: Could not open query supplied file\n", my_progname);
1608
1615
        exit(1);
1609
1616
      }
1610
 
      if (sbuf.st_size + 1 > SIZE_MAX)
 
1617
      if ((uint64_t)(sbuf.st_size + 1) > SIZE_MAX)
1611
1618
      {
1612
1619
        fprintf(stderr, "Request for more memory than architecture supports\n");
1613
1620
        exit(1);
1619
1626
        exit(1);
1620
1627
      }
1621
1628
      memset(tmp_string, 0, (size_t)(sbuf.st_size + 1));
1622
 
      read(data_file, (unsigned char*) tmp_string, (size_t)sbuf.st_size);
 
1629
      bytes_read= read(data_file, (unsigned char*) tmp_string,
 
1630
                       (size_t)sbuf.st_size);
1623
1631
      tmp_string[sbuf.st_size]= '\0';
1624
1632
      close(data_file);
 
1633
      if (bytes_read != sbuf.st_size)
 
1634
      {
 
1635
        fprintf(stderr, "Problem reading file: read less bytes than requested\n");
 
1636
      }
1625
1637
      if (user_supplied_query)
1626
1638
        actual_queries= parse_delimiter(tmp_string, &query_statements[0],
1627
1639
                                        delimiter[0]);
1649
1661
      fprintf(stderr,"%s: Could not open query supplied file\n", my_progname);
1650
1662
      exit(1);
1651
1663
    }
1652
 
    if (sbuf.st_size + 1 > SIZE_MAX)
 
1664
    if ((uint64_t)(sbuf.st_size + 1) > SIZE_MAX)
1653
1665
    {
1654
1666
      fprintf(stderr, "Request for more memory than architecture supports\n");
1655
1667
      exit(1);
1661
1673
      exit(1);
1662
1674
    }
1663
1675
    memset(tmp_string, 0, (size_t)(sbuf.st_size + 1));
1664
 
    read(data_file, (unsigned char*) tmp_string, (size_t)sbuf.st_size);
 
1676
    bytes_read= read(data_file, (unsigned char*) tmp_string,
 
1677
                     (size_t)sbuf.st_size);
1665
1678
    tmp_string[sbuf.st_size]= '\0';
1666
1679
    close(data_file);
 
1680
    if (bytes_read != sbuf.st_size)
 
1681
    {
 
1682
      fprintf(stderr, "Problem reading file: read less bytes than requested\n");
 
1683
    }
1667
1684
    if (user_supplied_pre_statements)
1668
1685
      (void)parse_delimiter(tmp_string, &pre_statements,
1669
1686
                            delimiter[0]);
1692
1709
      exit(1);
1693
1710
    }
1694
1711
 
1695
 
    if (sbuf.st_size + 1 > SIZE_MAX)
 
1712
    if ((uint64_t)(sbuf.st_size + 1) > SIZE_MAX)
1696
1713
    {
1697
1714
      fprintf(stderr, "Request for more memory than architecture supports\n");
1698
1715
      exit(1);
1705
1722
    }
1706
1723
    memset(tmp_string, 0, (size_t)(sbuf.st_size+1));
1707
1724
 
1708
 
    read(data_file, (unsigned char*) tmp_string,
1709
 
         (size_t)(sbuf.st_size));
 
1725
    bytes_read= read(data_file, (unsigned char*) tmp_string,
 
1726
                     (size_t)(sbuf.st_size));
1710
1727
    tmp_string[sbuf.st_size]= '\0';
1711
1728
    close(data_file);
 
1729
    if (bytes_read != sbuf.st_size)
 
1730
    {
 
1731
      fprintf(stderr, "Problem reading file: read less bytes than requested\n");
 
1732
    }
1712
1733
    if (user_supplied_post_statements)
1713
1734
      (void)parse_delimiter(tmp_string, &post_statements,
1714
1735
                            delimiter[0]);