[SSSD] [PATCH] 1371-Missing resolv.conf should be non-fatal

Ariel Barria olivares73 at hotmail.com
Tue Sep 11 02:21:05 UTC 2012


thanks to both for comments.

> Date: Fri, 7 Sep 2012 14:02:39 +0200
> From: jhrozek at redhat.com
> To: sssd-devel at lists.fedorahosted.org
> Subject: Re: [SSSD] [PATCH] 1371-Missing resolv.conf should be non-fatal
> 
> On Fri, Sep 07, 2012 at 12:41:30PM +0200, Michal Židek wrote:
> > On 09/07/2012 05:53 AM, Ariel Barria wrote:
> > >Patch sent for review.
> > >
> > >https://fedorahosted.org/sssd/ticket/1371
> > >
> > >
> > >_______________________________________________
> > >sssd-devel mailing list
> > >sssd-devel at lists.fedorahosted.org
> > >https://lists.fedorahosted.org/mailman/listinfo/sssd-devel
> > 
> > Hi Ariel,
> > 
> > I have not tested your patch, but I see some problems in it.
> > Do not set errno variable explicitly to 0. It is not how it is ment
> > to be used. 
> 
> Actually, it might be beneficial to clear errno in some cases. stat(2)
> is probably not one of them as it only sets errno in an error condition.
> 
> Here is a nice summary on the errno checking:
> https://www.securecoding.cert.org/confluence/pages/viewpage.action?pageId=6619179
> 
> > Also ENOENT is not the only possible error, we
> > should check for the other errors as well. Also do not clear
> > the return value of stat.
> > 
> > The check should look something like:
> > 
> > ret = stat( ... );
> > if (ret != 0) {
> 
> I would also assign the errno value to ret immediatelly to avoid
> rewriting errno with another DEBUG call for instance.
> 
> >     if (errno == ENOENT) {
> >         /* resolv.conf not found. This is the reason for this patch ...*/;
> >     } else {
> >         /* ... but we must check for other errors as well
> >          (the error msg here can be more general) */
> >     }
> > } else {
> >     /* Here is everything OK */
> > }
> _______________________________________________
> sssd-devel mailing list
> sssd-devel at lists.fedorahosted.org
> https://lists.fedorahosted.org/mailman/listinfo/sssd-devel
 		 	   		  
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.fedorahosted.org/pipermail/sssd-devel/attachments/20120910/be25f446/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-1371-Missing-resolv.conf-should-be-non-fatal.patch
Type: text/x-patch
Size: 1740 bytes
Desc: not available
URL: <https://lists.fedorahosted.org/pipermail/sssd-devel/attachments/20120910/be25f446/attachment.bin>


More information about the sssd-devel mailing list