Busybox largefile patch (fwd)

Rob Landley rob at landley.net
Mon Nov 14 00:53:53 UTC 2005


On Friday 28 October 2005 09:11, Tomasz Mateja wrote:
> I've got messages that you had problems with mailserver :)
> Resending then.
>
> Regards.
>
> --
> Tomek

Wandering through this finally.

It looks like what we really need is strto_off_t (which is a _horrible_ name, 
but you try coming up with something better).  Otherwise we wind up with 
chunks like this:
  if (ftpcmd("SIZE ", server_path, control_stream, buf) == 213) {
-  unsigned long value=filesize;
+  off_t value=filesize;
+#ifdef CONFIG_LFS
+  if (safe_strtoull(buf + 4, &value))
+#else
   if (safe_strtoul(buf + 4, &value))
+#endif
    bb_error_msg_and_die("SIZE error: %s", buf + 4);
   filesize = value;

And of course, filesize is already an off_t and the whole point of the 
shuffling in the first place was to translate sizes...

I'm also kind of disgusted by the implementatino of the safe_strto* functions.  
Not the new ones, the _old_ ones.  (Start with an assert()?  Save and restore 
the value of errno?)

It looks like what at least wget() wants is something that does 
bb_error_msg_and_die() if it can't get a number.  (That's what all the 
callers do.)  In wget's case it needs an atexit() to do some cleanup, but 
putting the cleanup in a macro is not an improvement...

I need to poke at this a bit.  I wonder if all uses of this function are as 
bad?  Looks like a misdesigned API, which I'd rather remove than add another 
instance of...

Rob



More information about the busybox mailing list