On Wed, Oct 23, 2013 at 11:04:58PM -0500, Serge Hallyn wrote:
> Quoting Stéphane Graber (stgra...@ubuntu.com):
> > Those are a bit less obvious than those I pushed directly to master.
> > All those changes were required to build LXC under clang here.
> > 
> > With this, gcc can be replaced by clang to build LXC so long as you're
> > not using the python3 binding (as python extensions can't be built under
> > clang at the moment).
> > 
> > For reference, the clang output for those is: 
> > http://paste.ubuntu.com/6292460/
> > 
> > Signed-off-by: Stéphane Graber <stgra...@ubuntu.com>
> 
> Acked-by: Serge E. Hallyn <serge.hal...@ubuntu.com>
> 
> One comment,
> 
> > ---
> >  src/lxc/caps.c     | 2 +-
> >  src/lxc/commands.c | 4 ++--
> >  src/lxc/conf.c     | 4 ++--
> >  3 files changed, 5 insertions(+), 5 deletions(-)
> > 
> > diff --git a/src/lxc/caps.c b/src/lxc/caps.c
> > index bcbb859..89b87af 100644
> > --- a/src/lxc/caps.c
> > +++ b/src/lxc/caps.c
> > @@ -204,7 +204,7 @@ static int _real_caps_last_cap(void)
> >                     buf[n] = '\0';
> >                     result = strtol(buf, &ptr, 10);
> >                     if (!ptr || (*ptr != '\0' && *ptr != '\n') ||
> > -                       result == LONG_MIN || result == LONG_MAX)
> > +                       result == INT_MIN || result == INT_MAX)
> 
> Hi Stéphane,
> 
> probably the original code was my fault, but this is weird.  The
> check doesn't actually guarantee anything, so per the NOTES section
> in strtoul(3) man page I think we should set errno to 0 before the
> strtol call, and check errno afterward.  Then drop these MIN/MAX
> checks here, leaving the < 0 check below.
> 
> Your patch wouldn't break anything so if you like we can just apply
> this and I'll push an update to do the above in the morning.

Sounds good.

I pushed my patch for now.

> 
> >                             result = -1;
> >             }
> >  
> > diff --git a/src/lxc/commands.c b/src/lxc/commands.c
> > index 33821dd..3e44ef3 100644
> > --- a/src/lxc/commands.c
> > +++ b/src/lxc/commands.c
> > @@ -109,7 +109,7 @@ static const char *lxc_cmd_str(lxc_cmd_t cmd)
> >             [LXC_CMD_GET_CONFIG_ITEM] = "get_config_item",
> >     };
> >  
> > -   if (cmd < 0 || cmd >= LXC_CMD_MAX)
> > +   if (cmd >= LXC_CMD_MAX)
> >             return "Unknown cmd";
> >     return cmdname[cmd];
> >  }
> > @@ -735,7 +735,7 @@ static int lxc_cmd_process(int fd, struct lxc_cmd_req 
> > *req,
> >             [LXC_CMD_GET_CONFIG_ITEM] = lxc_cmd_get_config_item_callback,
> >     };
> >  
> > -   if (req->cmd < 0 || req->cmd >= LXC_CMD_MAX) {
> > +   if (req->cmd >= LXC_CMD_MAX) {
> >             ERROR("bad cmd %d received", req->cmd);
> >             return -1;
> >     }
> > diff --git a/src/lxc/conf.c b/src/lxc/conf.c
> > index 208c08b..0724e3f 100644
> > --- a/src/lxc/conf.c
> > +++ b/src/lxc/conf.c
> > @@ -1948,7 +1948,7 @@ static int setup_caps(struct lxc_list *caps)
> >                     * we don't */
> >                     capid = strtol(drop_entry, &ptr, 10);
> >                     if (!ptr || *ptr != '\0' ||
> > -                   capid == LONG_MIN || capid == LONG_MAX)
> > +                   capid == INT_MIN || capid == INT_MAX)
> >                             /* not a valid number */
> >                             capid = -1;
> >                     else if (capid > lxc_caps_last_cap())
> > @@ -2013,7 +2013,7 @@ static int dropcaps_except(struct lxc_list *caps)
> >                     * we don't */
> >                     capid = strtol(keep_entry, &ptr, 10);
> >                     if (!ptr || *ptr != '\0' ||
> > -                   capid == LONG_MIN || capid == LONG_MAX)
> > +                   capid == INT_MIN || capid == INT_MAX)
> >                             /* not a valid number */
> >                             capid = -1;
> >                     else if (capid > lxc_caps_last_cap())
> > -- 
> > 1.8.3.2
> > 
> > 
> > ------------------------------------------------------------------------------
> > October Webinars: Code for Performance
> > Free Intel webinars can help you accelerate application performance.
> > Explore tips for MPI, OpenMP, advanced profiling, and more. Get the most 
> > from 
> > the latest Intel processors and coprocessors. See abstracts and register >
> > http://pubads.g.doubleclick.net/gampad/clk?id=60135991&iu=/4140/ostg.clktrk
> > _______________________________________________
> > Lxc-devel mailing list
> > Lxc-devel@lists.sourceforge.net
> > https://lists.sourceforge.net/lists/listinfo/lxc-devel

-- 
Stéphane Graber
Ubuntu developer
http://www.ubuntu.com

Attachment: signature.asc
Description: Digital signature

------------------------------------------------------------------------------
October Webinars: Code for Performance
Free Intel webinars can help you accelerate application performance.
Explore tips for MPI, OpenMP, advanced profiling, and more. Get the most from 
the latest Intel processors and coprocessors. See abstracts and register >
http://pubads.g.doubleclick.net/gampad/clk?id=60135991&iu=/4140/ostg.clktrk
_______________________________________________
Lxc-devel mailing list
Lxc-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/lxc-devel

Reply via email to