Skip to content

Commit

Permalink
groonga: add error check for PID file open failure
Browse files Browse the repository at this point in the history
GitHub: fix #368

Reported by Hiroyuki Sato. Thanks!!!
  • Loading branch information
kou committed Aug 6, 2015
1 parent bf3c479 commit c78ea64
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/groonga.c
Expand Up @@ -21,6 +21,7 @@
#include <ctype.h>
#include <fcntl.h>
#include <sys/stat.h>
#include <errno.h>

#ifdef WIN32
# define GROONGA_MAIN
Expand All @@ -32,6 +33,7 @@
#include <grn_proc.h>
#include <grn_db.h>
#include <grn_util.h>
#include <grn_error.h>

#ifdef HAVE_SYS_WAIT_H
# include <sys/wait.h>
Expand Down Expand Up @@ -544,6 +546,13 @@ create_pid_file(void)
}

pid_file = fopen(pid_file_path, "w");
if (!pid_file) {
fprintf(stderr,
"Failed to open PID file: <%s>: <%s>\n",
pid_file_path, grn_strerror(errno));
return;
}

{
#ifdef WIN32
DWORD pid;
Expand Down

0 comments on commit c78ea64

Please sign in to comment.