summaryrefslogtreecommitdiff
path: root/lib/strerror.c
Commit message (Collapse)AuthorAgeFilesLines
* Put LGPLv2+ notices in source files where appropriate.Bruno Haible2021-06-041-7/+7
| | | | | * lib/**.{h,c,gperf}: Use LGPLv2+ notice whenever the module description says so.
* maint: run 'make update-copyright'Paul Eggert2020-12-311-1/+1
|
* maint: Run 'make update-copyright'Paul Eggert2019-12-311-1/+1
|
* maint: Run 'make update-copyright'Paul Eggert2019-01-011-1/+1
|
* maint: Run 'make update-copyright'Paul Eggert2018-01-011-1/+1
|
* all: prefer https: URLsPaul Eggert2017-09-131-1/+1
|
* version-etc: new yearPaul Eggert2017-01-011-1/+1
| | | | | | | | | | * build-aux/gendocs.sh (version): * doc/gendocs_template: * doc/gendocs_template_min: * doc/gnulib.texi: * lib/version-etc.c (COPYRIGHT_YEAR): Update copyright dates by hand in templates and the like. * all files: Run 'make update-copyright'.
* strerror: Make it compile in C++ mode.Bruno Haible2016-11-191-1/+2
| | | | * lib/strerror.c (strerror): Ignore the return value of memcpy().
* version-etc: new yearPaul Eggert2016-01-011-1/+1
| | | | | | | | | | * build-aux/gendocs.sh (version): * doc/gendocs_template: * doc/gendocs_template_min: * doc/gnulib.texi: * lib/version-etc.c (COPYRIGHT_YEAR): Update copyright dates by hand in templates and the like. * all files: Run 'make update-copyright'.
* version-etc: new yearPaul Eggert2014-12-311-1/+1
| | | | | | * doc/gnulib.texi: * lib/version-etc.c (COPYRIGHT_YEAR): Update copyright date. * all files: Run 'make update-copyright'.
* maint: update copyrightEric Blake2014-01-011-1/+1
| | | | | | I ran 'make update-copyright'. Signed-off-by: Eric Blake <eblake@redhat.com>
* maint: update all copyright year number rangesEric Blake2013-01-011-1/+1
| | | | | | Run "make update-copyright". Compare to commit 1602f0a from last year. Signed-off-by: Eric Blake <eblake@redhat.com>
* maint: update all copyright year number rangesJim Meyering2012-01-011-1/+1
| | | | Run "make update-copyright".
* strerror_r: fix OpenBSD behavior on 0Eric Blake2011-06-211-14/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | OpenBSD treats strerror_r(0,,) as a success, but with a message "Undefined error: 0"; while this is distinct from strerror_r(-1,,) returning "Unknown error: -1", it does not imply success. Meanwhile, if buf is short enough for ERANGE, then we can't use strstr to look for "Unknown" or "Undefined" in the resulting message, like we had been doing for strerror(). Fix this by shifting the burden - now the strerror-override code guarantees that 0 will have an override when needed. * lib/strerror-override.c (strerror_override): Also override 0 when needed. * lib/strerror-override.h (strerror_override): Likewise. * lib/strerror.c (strerror): Simplify, now that 0 override is done earlier. * lib/strerror_r.c (strerror_r): Likewise. * m4/strerror.m4 (gl_FUNC_STRERROR): Split detection of 0 behavior... (gl_FUNC_STRERROR_0): ...into new macro. * m4/strerror_r.m4 (gl_FUNC_STRERROR_R): Replace strerror_r if 0 is overridden. (gl_FUNC_STRERROR_R_WORKS): Avoid extra tests if 0 is broken. * modules/strerror-override (Files): Add strerror.m4. (configure.ac): Also provide override for 0 when needed. * doc/posix-functions/strerror.texi (strerror): Document this. * doc/posix-functions/perror.texi (perror): Likewise. Signed-off-by: Eric Blake <eblake@redhat.com>
* strerror_r-posix: fix on MacOSEric Blake2011-06-081-3/+7
| | | | | | | | | | | | | | | | | | | | | MacOS X 10.5 strerror(0) is "Unknown error: 0", which is not distinguished from "Unknown error: -1" for out-of-range. Worse, strerror_r(0,,) is "Undefined error: 0", although strerror_r for all other out-of-range values matches strerror. * m4/strerror.m4 (gl_FUNC_STRERROR): Flush out MacOS bug. * m4/strerror_r.m4 (gl_FUNC_STRERROR_R_WORKS): Likewise, and fix logic bug. * lib/strerror_r.c (strerror_r): Fix the bug. * lib/strerror.c (strerror): Likewise. * doc/posix-functions/strerror_r.texi (strerror_r): Document the problem. * doc/posix-functions/strerror.texi (strerror): Likewise. * doc/posix-functions/perror.texi (perror): Likewise. * tests/test-strerror.c (main): Enhance test. * tests/test-strerror_r.c (main): Likewise. Signed-off-by: Eric Blake <eblake@redhat.com>
* strerror: work around FreeBSD bugEric Blake2011-06-061-1/+13
| | | | | | | | | | Breaking strerror away from strerror_r re-exposed the FreeBSD strerror(0) bug. * lib/strerror.c (strerror): Special case 0. Reported by Bruno Haible. Signed-off-by: Eric Blake <eblake@redhat.com>
* strerror: drop strerror_r dependencyEric Blake2011-06-011-1/+35
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | Since the errno module is responsible for introducing replacement errno values, it should also be responsible for translating those new values into strings. And by moving the replacements into a file managed by the errno, we can then break the dependency between strerror and strerror_r, so that strerror no longer drags in multi-threading modules required by strerror_r. Tested on glibc with: gl_cv_header_errno_h_complete=no gl_cv_func_working_strerror=no \ gl_cv_func_strerror_r_works=no ./gnulib-tool --with-tests \ --test strerror strerror_r-posix * lib/strerror_r.c (strerror_r): Move gnulib replacement strings... * lib/strerror-override.c (strerror_override): ...to new file. * lib/strerror-override.h: Add prototype. * lib/strerror-impl.h: Delete. * lib/strerror.c (strerror): New implementation. * modules/errno (Files): Add new files. (configure.ac): Compile new file as appropriate. * modules/strerror (Files): Drop unused file. (Depends-on): Drop strerror_r-posix. * MODULES.html.sh: Document strerror_r-posix. Requested by Sam Steingold. Signed-off-by: Eric Blake <eblake@redhat.com>
* relocatable-prog-wrapper: Assume strerror() exists.Bruno Haible2011-05-211-11/+7
| | | | | | | | | | | * modules/relocatable-prog-wrapper (Files): Remove lib/strerror.c, m4/strerror.m4. (configure.ac): Don't invoke gl_FUNC_STRERROR_SEPARATE. * lib/relocwrapper.c: Remove mention of strerror module. * lib/strerror.c: Assume REPLACE_STRERROR is 1. * m4/strerror.m4 (gl_FUNC_STRERROR_SEPARATE): Remove macro. (gl_FUNC_STRERROR): Inline it here. Don't define REPLACE_STRERROR as a C macro.
* perror: Avoid clobbering the strerror buffer when possible.Bruno Haible2011-05-191-21/+1
| | | | | | | | | | | * lib/strerror-impl.h: New file, extracted from lib/strerror.c. * lib/strerror.c: Include it. * modules/strerror (Files): Add lib/strerror-impl.h. * lib/perror.c: Include <stdlib.h>, intprops.h, verify.h. (my_strerror): New function, defined through lib/strerror-impl.h. (perror): Use it instead of strerror. * modules/perror (Files): Add lib/strerror-impl.h. (Depends-on): Remove strerror. Add intprops, verify, strerror_r-posix.
* strerror_r: Avoid clobbering the strerror buffer when possible.Bruno Haible2011-05-191-314/+15
| | | | | | | | | * lib/strerror_r.c (strerror_r): Merge the three implementations. Handle gnulib defined errno values here. When strerror() returns NULL or an empty string, return EINVAL. * lib/strerror.c (strerror): Always call strerror_r. Don't handle gnulib defined errno values here. * modules/strerror (Depends-on): Add verify, strerror_r-posix.
* maint: update almost all copyright ranges to include 2011Jim Meyering2011-01-011-1/+1
| | | | Run the new "make update-copyright" rule.
* Define missing EDQUOT on NonStop Kernel.Bruno Haible2010-10-021-0/+6
| | | | | | | | | | * lib/errno.in.h (EDQUOT): Assign a value if missing. * lib/strerror.c (rpl_strerror): Handle missing EDQUOT. * m4/errno_h.m4 (gl_HEADER_ERRNO_H): Also test whether EDQUOT is missing. * doc/posix-headers/errno.texi: Mention the NSK bug. * doc/posix-functions/strerror.texi: Mention the workaround on NSK. Reported by Joachim Schmitz <schmitz@hp.com>.
* Avoid relocwrapper link errors due to gnulib replacement functions.Bruno Haible2010-06-091-0/+3
|
* update nearly all FSF copyright year lists to include 2010Jim Meyering2010-01-011-1/+1
| | | | | Use the same procedure as for 2009, outlined in http://thread.gmane.org/gmane.comp.lib.gnulib.bugs/20081
* Use spaces for indentation, not tabs.Bruno Haible2009-12-101-4/+4
|
* Define missing ESTALE on Interix 3.5.Bruno Haible2009-06-171-1/+7
|
* strerror: avoid warnings about discarding "const"Jim Meyering2009-01-161-68/+136
| | | | | | * lib/strerror.c (rpl_strerror): Instead of returning a const string from each and every "case", use a variable, and add a single cast after the switch.
* Define EWOULDBLOCK to the same value as EAGAIN.Paolo Bonzini2008-10-031-4/+3
|
* Extend strerror to cover the added errno values.Bruno Haible2008-09-141-9/+234
|
* Change strerror so that it never returns an empty string.Bruno Haible2007-10-271-1/+1
|
* Simplify and modernize strerror substitute, partly to fix Solaris 8 bug.Paul Eggert2007-10-111-43/+14
| | | | | | | | | | | | | | | | | * lib/strerror.c: Include <string.h> always, to test interface, and to remove the need for the dummy. Include intprops.h to compute width instead of doing it ourselves and missing a CHAR_BIT declaration, which broke tar 1.19 on Solaris 8. (strerror): Define it to return NULL if there's no system strerror. (rpl_strerror): Use INT_STRLEN_BOUND to compute bound. Omit !HAVE_STRERROR code. We don't need to worry about supporting ancient pre-strerror Unix systems well any more. Saying "unknown system error" is enough. * lib/string.in.h (strerror): Simplify the ifdef to reflect the simpler strerror.c implementation. * m4/strerror.m4 (gl_FUNC_STRERROR_SEPARATE, gl_PREREQ_STDERROR): Simplify the tests to reflect the simpler strerror implementation. * modules/strerror (Depends-on): Add intprops.
* Change copyright notice from GPLv2+ to GPLv3+.Bruno Haible2007-10-071-5/+4
|
* Fix strerror on Interix.Eric Blake2007-09-251-1/+23
| | | | | | | | | | | | | | | | | | | | | * lib/string_.h (strerror): Declare replacement. * doc/functions/strerror.texi (strerror): Document the Interix shortcoming. * modules/string (Makefile.am): Support new hooks. * m4/string_h.m4 (gl_HEADER_STRING_H_DEFAULTS): Add new hooks. * m4/strerror.m4 (gl_FUNC_STRERROR): Defer to gl_FUNC_STRERROR_SEPARATE. (gl_FUNC_STRERROR_SEPARATE): Check for Interix bug. * lib/strerror.c (rpl_strerror): Provide replacement. * modules/strerror (Depends-on): Add string. (configure.ac): Detect use of module. * tests/test-strerror.c: New file. * modules/strerror-tests: New test module. * modules/argp (Depends-on): Add strerror. * modules/error (Depends-on): Likewise. Reported by Martin Koeppe. Signed-off-by: Eric Blake <ebb9@byu.net>
* Oops, really avoid an empty translation unit.Bruno Haible2007-03-041-3/+9
|
* Make it possible to compile strerror.c separately, unconditionally.Bruno Haible2007-03-031-1/+5
|
* * _fpending.c: Include <config.h> unconditionally, since we noPaul Eggert2006-09-131-5/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | longer worry about uses that don't define HAVE_CONFIG_H. * acl.c, alloca.c, argmatch.c, atexit.c, backupfile.c: * basename.c, c-stack.c, c-strtod.c, calloc.c, canon-host.c: * canonicalize.c, chdir-long.c, chdir-safer.c, chown.c: * cloexec.c, close-stream.c, closeout.c, creat-safer.c: * cycle-check.c, diacrit.c, dirchownmod.c, dirfd.c, dirname.c: * dup-safer.c, dup2.c, error.c, euidaccess.c, exclude.c: * exitfail.c, fchmodat.c, fchown-stub.c, fd-safer.c: * file-type.c, fileblocks.c, filemode.c, filenamecat.c: * fnmatch.c, fopen-safer.c, fprintftime.c, free.c, fsusage.c: * ftruncate.c, fts-cycle.c, fts.c, full-write.c, gai_strerror.c: * getcwd.c, getdate.y, getdomainname.c, getgroups.c: * gethostname.c, gethrxtime.c, getloadavg.c, getlogin_r.c: * getndelim2.c, getnline.c, getopt.c, getopt1.c, getpass.c: * gettime.c, gettimeofday.c, getugroups.c, getusershell.c: * glob.c, group-member.c, hard-locale.c, hash-pjw.c, hash.c: * human.c, idcache.c, inet_ntop.c, inet_pton.c, inttostr.c: * isdir.c, lchown.c, linebuffer.c, long-options.c, lstat.c: * malloc.c, md5.c, memcasecmp.c, memchr.c, memcmp.c, memcoll.c: * memcpy.c, memmove.c, memrchr.c, mkancesdirs.c, mkdir-p.c: * mkdir.c, mkdirat.c, mkstemp-safer.c, mkstemp.c, modechange.c: * mountlist.c, nanosleep.c, obstack.c, open-safer.c: * openat-die.c, openat.c, pagealign_alloc.c, physmem.c: * pipe-safer.c, posixtm.c, posixver.c, putenv.c, quote.c: * quotearg.c, raise.c, readtokens.c, readtokens0.c, readutmp.c: * realloc.c, regex.c, rename.c, rmdir.c, rpmatch.c, safe-read.c: * same.c, save-cwd.c, savedir.c, setenv.c, settime.c, sha1.c: * sig2str.c, snprintf.c, strdup.c, strerror.c, strftime.c: * stripslash.c, strndup.c, strnlen.c, strpbrk.c, strtod.c: * strtoimax.c, strtol.c, strverscmp.c, tempname.c, time_r.c: * timegm.c, tmpfile-safer.c, unlinkdir.c, userspec.c, utime.c: * utimecmp.c, utimens.c, version-etc-fsf.c, version-etc.c: * xalloc-die.c, xgetcwd.c, xgethostname.c, xmalloc.c: * xmemcoll.c, xnanosleep.c, xreadlink.c, xstrtod.c: * xstrtoimax.c, xstrtol.c, xstrtoumax.c, yesno.c: Likewise.
* Use a consistent style for including <config.h>.Paul Eggert2005-09-191-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * __fpending.c, acl.c, argmatch.c, argp-help.c, argp-parse.c, argp-pvh.c, backupfile.c, basename.c, c-stack.c, calloc.c, check-version.c, cloexec.c, closeout.c, copy-file.c, creat-safer.c, cycle-check.c, dirfd.c, dirname.c, dup-safer.c, dup2.c, euidaccess.c, exclude.c, exitfail.c, fatal-signal.c, fd-safer.c, file-type.c, fileblocks.c, filemode.c, filenamecat.c, findprog.c, fnmatch.c, fopen-safer.c, free.c, fsusage.c, ftruncate.c, full-write.c, fwriteerror.c, getaddrinfo.c, getcwd.c, getdelim.c, getline.c, getlogin_r.c, getndelim2.c, getnline.c, getopt1.c, getpass.c, group-member.c, hard-locale.c, hash-pjw.c, hash.c, human.c, idcache.c, inet_ntop.c, isdir.c, long-options.c, malloc.c, memcasecmp.c, memcmp.c, memcoll.c, memcpy.c, memmove.c, mkdir-p.c, modechange.c, mountlist.c, open-safer.c, physmem.c, pipe-safer.c, pipe.c, poll.c, posixver.c, progname.c, progreloc.c, putenv.c, quote.c, quotearg.c, readline.c, readlink.c, realloc.c, regex.c, rename.c, rmdir.c, rpmatch.c, safe-read.c, same.c, save-cwd.c, savedir.c, sig2str.c, strcspn.c, strerror.c, stripslash.c, strncasecmp.c, strndup.c, strnlen.c, strnlen1.c, strsep.c, strstr.c, strtod.c, strtoimax.c, strtol.c, strverscmp.c, tempname.c, time_r.c, userspec.c, utimecmp.c, version-etc-fsf.c, version-etc.c, wait-process.c, xalloc-die.c, xgetcwd.c, xmalloc.c, xmemcoll.c, xnanosleep.c, xreadlink.c, xsetenv.c, xstrndup.c, xstrtoimax.c, xstrtol.c, xstrtoumax.c, yesno.c: Standardize inclusion of config.h. * __fpending.h, dirfd.h, getdate.h, human.h, inttostr.h: Removed inclusion of config.h from header files. * inttostr.c: Adjusted in-tree users. * timespec.h: Remove superfluous warning to include config.h. * atexit.c, chdir-long.c chown.c, fchown-stub.c, getgroups.c, gettimeofday.c, lchown.c, lstat.c, mkdir.c, mkstemp.c, nanosleep.c, openat.c, raise.c, readtokens0.c, readutmp.c, unlinkdir.c: Guard inclusion of config.h with HAVE_CONFIG_H.
* *** empty log message ***Paul Eggert2005-05-141-1/+1
|
* Include config.h, limits.h. Declare sprintf.Paul Eggert2003-07-311-12/+24
| | | | (strerror): Don't assume that a printable int fits in 14 bytes.
* simplest versionKarl Berry2002-09-031-0/+37