Re: [ogfs-dev]OGFS: can't read journal index (-12)
On Mon, 2003-05-12 at 18:48, Aneesh Kumar K.V wrote:
> On Mon, 2003-05-12 at 15:02, Dominik Vogt wrote:
> > On Mon, May 12, 2003 at 03:38:23PM +0800, Franco Broi wrote:
> >
> > I see. It's because the error code is set before the test for the
> > actual error condition. I see this all over to ogfs code and I
> > think it's a very bad idea because you have to keep the current
> > contents of the return value in mind for the rest of the function.
> > I'll commit a fix.
>
> I have seen it at many places. I found it useful when most of the check
> will return the same error and when success you explicitly say ret=0
>
> ie
>
> ret = -ENOMEM;
>
> ret= my_func1()
> if(ret)
> goto out;
But you've changed ret, so there was no point setting it to -ENOMEM!!
It makes more sense if you say:
ret = -ENOMEM;
if(my_func1() < 0)
goto out;
> ret = my_func2()
> if(ret)
> goto out
> ret = 0;
>
> out:
> return ret;
>
> -aneesh
>
>
>
>
>
> -------------------------------------------------------
> Enterprise Linux Forum Conference & Expo, June 4-6, 2003, Santa Clara
> The only event dedicated to issues related to Linux enterprise solutions
> www.enterpriselinuxforum.com
>
> _______________________________________________
> Opengfs-devel mailing list
> Opengfs-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/opengfs-devel
-------------------------------------------------------
Enterprise Linux Forum Conference & Expo, June 4-6, 2003, Santa Clara
The only event dedicated to issues related to Linux enterprise solutions
www.enterpriselinuxforum.com
_______________________________________________
Opengfs-devel mailing list
Opengfs-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/opengfs-devel
[Kernel]
[Security]
[Bugtraq]
[Photo]
[Yosemite]
[MIPS Linux]
[ARM Linux]
[Linux Clusters]
[Linux RAID]
[Yosemite Hiking]
[Linux Resources]