* Curious code in init()
@ 2014-04-02 8:33 Erwan Velu
2014-04-02 14:24 ` Jens Axboe
0 siblings, 1 reply; 2+ messages in thread
From: Erwan Velu @ 2014-04-02 8:33 UTC (permalink / raw)
To: fio
Hey Jens,
The following code is pretty confusing for me :
http://git.kernel.dk/?p=fio.git;a=blob;f=init.c;h=c3996a76c12840e3ab3cf6514e5d5dce611a1077;hb=HEAD#l1962
The "if (nr_clients && fio_clients_connect()) {" is using the do_exit
concept while being after the code that manage it and does a return -1
while exit code is set to 1.
I don't get how it should be fixed.
1- we shall move the if nr_clients before the "if (do_exit", remove the
return -1 and adjust the exit_code ?
2- we shall get rid of the do_exit & exit code semantic of the if
nr_clients.
What was the intent while reading the code ? ;o)
Erwan,
^ permalink raw reply [flat|nested] 2+ messages in thread* Re: Curious code in init()
2014-04-02 8:33 Curious code in init() Erwan Velu
@ 2014-04-02 14:24 ` Jens Axboe
0 siblings, 0 replies; 2+ messages in thread
From: Jens Axboe @ 2014-04-02 14:24 UTC (permalink / raw)
To: Erwan Velu, fio
On 2014-04-02 02:33, Erwan Velu wrote:
> Hey Jens,
>
> The following code is pretty confusing for me :
> http://git.kernel.dk/?p=fio.git;a=blob;f=init.c;h=c3996a76c12840e3ab3cf6514e5d5dce611a1077;hb=HEAD#l1962
>
>
> The "if (nr_clients && fio_clients_connect()) {" is using the do_exit
> concept while being after the code that manage it and does a return -1
> while exit code is set to 1.
>
> I don't get how it should be fixed.
> 1- we shall move the if nr_clients before the "if (do_exit", remove the
> return -1 and adjust the exit_code ?
> 2- we shall get rid of the do_exit & exit code semantic of the if
> nr_clients.
>
> What was the intent while reading the code ? ;o)
It should probably just be turned into an exit(1) or similar exit code.
The current code will work to the extent that it will properly exit,
however it wont signal the error correctly in the return value.
--
Jens Axboe
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2014-04-02 14:24 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-04-02 8:33 Curious code in init() Erwan Velu
2014-04-02 14:24 ` Jens Axboe
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox