Permalink
Browse files

Truncate pid_file before writing pid

  • Loading branch information...
1 parent 79c204a commit 58084b287662332433ab32ad05023594fcb7082a @dekellum committed Feb 22, 2010
Showing with 9 additions and 0 deletions.
  1. +9 −0 pidfile.c
View
9 pidfile.c
@@ -73,8 +73,17 @@ apr_status_t lock_pid_file()
}
if( rv == APR_SUCCESS ) {
+ rv = apr_file_trunc( _pid_file, 0 );
+ if( rv != APR_SUCCESS ) {
+ ERROR( "Could not truncate pid file [%s].", pfile_name );
+ apr_file_close( _pid_file );
+ }
+ }
+
+ if( rv == APR_SUCCESS ) {
apr_file_printf( _pid_file, "%d\n", getpid() );
}
+
}
return rv;

0 comments on commit 58084b2

Please sign in to comment.