Skip to content

Commit

Permalink
Fix warning about not checking return value of mkstemp()
Browse files Browse the repository at this point in the history
  • Loading branch information
Brad Hards committed Nov 16, 2010
1 parent cb271ae commit a9636fa
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions libmapi++/tests/profile_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,10 @@ int main ()
{
char *tmpname = (char*) calloc(sizeof(PROFILEDB_NAME_TEMPLATE) + 1, sizeof(char));
strncpy(tmpname, PROFILEDB_NAME_TEMPLATE, sizeof(PROFILEDB_NAME_TEMPLATE));
mkstemp(tmpname);
int ret = mkstemp(tmpname);
if (ret < 0) {
std::cout << "failed to create temporary file: " << strerror(errno) << std::endl;
}
if (libmapipp::profile_database::create_profile_store(tmpname)) {
std::cout << "success creating a temporary profile store" << std::endl;
} else {
Expand All @@ -47,7 +50,10 @@ int main ()
{
char *tmpname2 = (char*) calloc(sizeof(PROFILEDB_NAME_TEMPLATE) + 1, sizeof(char));
strncpy(tmpname2, PROFILEDB_NAME_TEMPLATE, sizeof(PROFILEDB_NAME_TEMPLATE));
mkstemp(tmpname2);
int ret = mkstemp(tmpname2);
if (ret < 0) {
std::cout << "failed to create temporary file: " << strerror(errno) << std::endl;
}
if (libmapipp::profile_database::create_profile_store(std::string(tmpname2))) {
std::cout << "success creating a temporary profile store with std::string" << std::endl;
} else {
Expand Down

0 comments on commit a9636fa

Please sign in to comment.