Commit 1dfc6b13 authored by Thomas Guillem's avatar Thomas Guillem

keystore/file: fix error path

parent 807ff3b7
...@@ -296,17 +296,22 @@ file_open(const char *psz_file, const char *psz_mode, FILE **pp_file) ...@@ -296,17 +296,22 @@ file_open(const char *psz_file, const char *psz_mode, FILE **pp_file)
int i_fd = fileno(p_file); int i_fd = fileno(p_file);
if (i_fd == -1) if (i_fd == -1)
{
fclose(p_file);
return -1; return -1;
}
#ifdef HAVE_FLOCK #ifdef HAVE_FLOCK
if (flock(i_fd, LOCK_EX) != 0) if (flock(i_fd, LOCK_EX) != 0)
{ {
fclose(p_file); fclose(p_file);
return -1;
} }
#elif defined (HAVE_FCNTL) && defined (F_SETLKW) #elif defined (HAVE_FCNTL) && defined (F_SETLKW)
if (posix_lock_fd(i_fd) != 0) if (posix_lock_fd(i_fd) != 0)
{ {
fclose(p_file); fclose(p_file);
return -1;
} }
#endif #endif
*pp_file = p_file; *pp_file = p_file;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment