File tree 1 file changed +18
-3
lines changed
1 file changed +18
-3
lines changed Original file line number Diff line number Diff line change @@ -2565,6 +2565,7 @@ static int write_pid(pid_t pid, const char *pidfile)
2565
2565
*/
2566
2566
int fio_start_server (char * pidfile )
2567
2567
{
2568
+ FILE * file ;
2568
2569
pid_t pid ;
2569
2570
int ret ;
2570
2571
@@ -2597,14 +2598,28 @@ int fio_start_server(char *pidfile)
2597
2598
setsid ();
2598
2599
openlog ("fio" , LOG_NDELAY |LOG_NOWAIT |LOG_PID , LOG_USER );
2599
2600
log_syslog = true;
2600
- close (STDIN_FILENO );
2601
- close (STDOUT_FILENO );
2602
- close (STDERR_FILENO );
2601
+
2602
+ file = freopen ("/dev/null" , "r" , stdin );
2603
+ if (!file )
2604
+ perror ("freopen" );
2605
+
2606
+ file = freopen ("/dev/null" , "w" , stdout );
2607
+ if (!file )
2608
+ perror ("freopen" );
2609
+
2610
+ file = freopen ("/dev/null" , "w" , stderr );
2611
+ if (!file )
2612
+ perror ("freopen" );
2613
+
2603
2614
f_out = NULL ;
2604
2615
f_err = NULL ;
2605
2616
2606
2617
ret = fio_server ();
2607
2618
2619
+ fclose (stdin );
2620
+ fclose (stdout );
2621
+ fclose (stderr );
2622
+
2608
2623
closelog ();
2609
2624
unlink (pidfile );
2610
2625
free (pidfile );
You can’t perform that action at this time.
0 commit comments