Package: lbzip2 Version: 0.18-2 Severity: important Tags: patch User: debian-...@lists.debian.org Usertags: kfreebsd
Hi, your package FTBFS on GNU/kFreeBSD: | gcc $(/bin/sh lfs.sh CFLAGS) -D _XOPEN_SOURCE=500 -pipe -ansi -pedantic -g3 -Wall -O2 -c main.c | main.c:115: error: 'ENODATA' undeclared here (not in a function) | main.c:125: error: 'ENOSR' undeclared here (not in a function) | main.c:126: error: 'ENOSTR' undeclared here (not in a function) | main.c:147: error: 'ETIME' undeclared here (not in a function) | make[1]: *** [main.o] Error 1 One could think of declaring the constant → string for each of them conditionally, as already done for ECANCELED, but really, upstream shouldn't be inventing the wheel again. There's strerror() for that already. To keep the diff minimal, I used it in err2str()'s implementation, and #if 0'd the big array out. Thanks for considering. Mraw, KiBi.
--- a/main.c +++ b/main.c @@ -58,6 +58,7 @@ bailout(void) const char *pname; +#if 0 struct errstr { int err; @@ -150,20 +151,13 @@ static const struct errstr errstr[] = { { EWOULDBLOCK, "Operation would block" }, { EXDEV, "Cross-device link" } }; +#endif const char * err2str(int err) { - size_t idx; - - for (idx = 0u; idx < sizeof errstr / sizeof errstr[0]; ++idx) { - if (errstr[idx].err == err) { - return errstr[idx].str; - } - } - - return "Unknown error"; + return strerror(err); }