[lkml]   [2007]   [Aug]   [3]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
    SubjectRe: [PATCH -mm] Introduce strtol_check_range()
    Hi Jan,

    On Fri, 3 Aug 2007, Jan Engelhardt wrote:

    > On Aug 2 2007 05:16, Satyam Sharma wrote:
    > >
    > >BSD's strtonum(3) is a detestful, horrible shame.
    > >
    > >The strtol_check_range() I implemented here does _all_ that strtonum()
    > >does, plus is generic w.r.t. base, and minus the tasteless "errstr"
    > >argument.
    > >
    > >Tell me, how does that "errstr" ever make sense? We _anyway_ return
    > >errors (-EINVAL or -ERANGE) if any of those cases show up.
    > errstr (well, at least for strtol) are useful to find the first character that
    > does not make up a number (and then do whatever the user wants to, including,
    > continuing to parse). For example "chown 0:1337", strtol on "0:1337" should
    > give errstr=pointer to the ":", then check for it being a ':', then you know
    > the next char is the GID. :)

    We were actually discussing the "errstr" that's the fourth argument of
    BSD's strtonum(3) which has quite radically different semantics [1]
    from the "endptr" argument of strtol(3). Anyway, I originally
    misunderstood the interface / the correct way to be using that function
    as I later mentioned in the other mail -- also see the answer to point
    #3 in [2]. Porting it over to here does sound like a good idea.

    I'm off on vacation with little or intermittent (possibly none) access
    to email for the next 10 days, so please feel free to beat me to it :-)


    To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
    the body of a message to
    More majordomo info at
    Please read the FAQ at

     \ /
      Last update: 2007-08-03 10:49    [W:0.021 / U:1.528 seconds]
    ©2003-2017 Jasper Spaans. hosted at Digital OceanAdvertise on this site