On 07/05/2012 02:06 PM, levin li wrote:
> From: levin li <[email protected]>
> 
> Sheep doesn't read the journal head in journal_recover which
> always leaves all the fields of journal head uninitialized,
> so the target_path is something random.
> 
> Signed-off-by: levin li <[email protected]>
> ---
>  sheep/journal.c |    6 ++++++
>  1 files changed, 6 insertions(+), 0 deletions(-)
> 
> diff --git a/sheep/journal.c b/sheep/journal.c
> index d082aa2..74384b2 100644
> --- a/sheep/journal.c
> +++ b/sheep/journal.c
> @@ -257,6 +257,12 @@ int jrnl_recover(const char *jrnl_dir)
>                       goto end_while_3;
>               }
>  
> +             ret = pread64(jd.fd, &jd.head, sizeof(jd.head), 0);

why not use xpread which handles short read? I think all pread64 should
be changed into xpread

Thanks,
Yuan
> +             if (ret != sizeof(jd.head)) {
> +                     eprintf("can't read journal head\n");
> +                     goto end_while_2;
> +             }
> +
>               ret = pread64(jd.fd, &end_mark, sizeof(end_mark),
>                               sizeof(jd.head) + jd.head.size);
>               if (ret != sizeof(end_mark)) {
> 


-- 
sheepdog mailing list
[email protected]
http://lists.wpkg.org/mailman/listinfo/sheepdog

Reply via email to