AW: AW: tar returns error 256?

Denys Vlasenko vda.linux at googlemail.com
Wed Jun 10 11:52:23 UTC 2009


On Wed, Jun 10, 2009 at 11:08 AM, Stefan Seyfried<seife at suse.de> wrote:
>> I use something like this:
>>
>>   ret = system("tar ....");
>>   if(ret)
>>     eprintf("tar failed with error %d\n",ret);
>
> Let me quote the man page of system(3) for you:
>
> RETURN VALUE
>       The value returned is -1 on error (e.g.   fork(2)  failed),
>       and  the return status of the command otherwise.  This lat-
>       ter return status is in the format  specified  in  wait(2).
>       Thus, the exit code of the command will be WEXITSTATUS(sta-
>       tus).  In case /bin/sh could not be executed, the exit sta-
>       tus will be that of a command that does exit(127).
>
> So your code is wrong, it's probably not busybox/tar's fault.

How did you conclude that it's not busybox/tar's fault?
system("tar ..."); should normally return 0,
so something is definitely is not working right.
It may be a busybox tar problem.
We do not have enough info yet to know, but the fact that
tar file gets created tells that tar was successfully exec'ed.
(it's not fork or exec failure, that is)

Uwe, can you "strace -f -o LOGFILE your_program"? It will show
what's going on.

Does it ever happen when you run the very same tar command from
command line?
--
vda


More information about the busybox mailing list