Commit Graph

11318 Commits

Author SHA1 Message Date
mlelstv 9d5943131b Fix parsing a locale string with multiple components.
Also check for truncation of a long locale string.
2023-04-16 20:37:59 +00:00
christos c41e469284 PR/57250: Martin Husemann: dtoa mishandles infinite doubles on 32bit big
endian machines. When long double support was added, the old code was kept
for the regular double code. This code was never used because WIDE_DOUBLE
was always defined in the Makefile. Remove that old code, and conditionalize
the WIDE_DOUBLE code based on if long doubles are different than doubles on
the specific platform.
2023-04-04 19:26:06 +00:00
skrll 85c3279dc2 Trailing whitespace 2023-04-02 07:26:17 +00:00
dholland d3728fec90 Fix lying comment. 2023-04-01 23:44:11 +00:00
thorpej 8ff22ec6c6 Document the error code when O_REGULAR is specified and the last
path component is not a regular file.
2023-03-05 16:24:31 +00:00
riastradh 0670f81a19 mremap(2): Note MAP_REMAPDUP bug.
XXX pullup-10, unless we fix the bug first
2023-03-03 12:53:04 +00:00
riastradh 0119a38611 mremap(2): Fix example to use MAP_PRIVATE.
It is a historical accident that MAP_PRIVATE is assumed when neither
it nor MAP_SHARED is specified.

XXX pullup-9
XXX pullup-10
2023-03-01 20:08:41 +00:00
uwe af2cb705a7 mmap(2): minor markup tweaks 2023-03-01 15:11:28 +00:00
rillig 17359e5a32 hcreate.3: fix typo 2023-02-21 19:27:14 +00:00
simonb a411c1a557 Note that strchrnul() first appeared in glibc 2.1.1 and appeared in
FreeBSD 10 before it appeared in NetBSD 8.
2023-01-31 01:42:32 +00:00
rillig 2f7da51144 fmtmsg.3: fix typo 2023-01-22 13:38:48 +00:00
riastradh e10add6b30 inet(3): Fix typo in description of size argument.
This is the size of dst, not of src.  The size of src is determined
by the address family.

Fix markup while here: .Fa for function arguments, not .Ar which is
for command arguments.
2023-01-18 23:16:05 +00:00
simonb 1daaca1c6c KNF nit: opening brace of a function on next line. 2023-01-18 08:07:22 +00:00
christos e42273ba0d put attributes first for c23 compliance. 2023-01-17 13:18:03 +00:00
christos 20fbed3887 Apply 9cfe9507fcc22cd4a0c4da486ea1c7f0de6b075f for C23 attribute compliance.
Requested by Jan-Benedict Glaw.
2023-01-15 18:12:37 +00:00
kre b666381035 Add errc() and verrc() to the list of functions which do not return,
but exit() instead.

This was omitted when the *c() set of functions were added in 2014.
2023-01-05 15:13:57 +00:00
nia 4afdaab748 setlocale.3: Reflect state of NetBSD locale support in the 21st century
Don't use LC_COLLATE in a real code example, since a real call to set
LC_COLLATE will fail. Mention this.

Inconsistencies noticed by khw on IRC.
2022-12-31 14:35:56 +00:00
riastradh ddb0a7e7a7 swab(3): Rewrite this to be understandable.
And make the tests work, and exercise all lengths up to 100.

Evidently the previous definition, presumably tightly optimized for
1980s-era compilers and CPUs, was too hard to understand, because it
was incorrectly tested for two decades and broken for years.

PR lib/57141

XXX pullup-8
XXX pullup-9
XXX pullup-10
2022-12-28 15:34:19 +00:00
kre aab5fac668 PR lib/57141 - never decrement len without actually performing a STEP. 2022-12-28 14:32:04 +00:00
wiz eb7b4f7765 Remove unneeded -D_OPENBSD_SOURCE 2022-12-21 17:44:15 +00:00
christos 93664a940b Handle the case the code originally intended to handle; systems where:
SIZE_MAX < PTRDIFF_MAX
2022-12-13 19:08:42 +00:00
skrll e311a492a7 Trailing whitespace 2022-12-13 12:43:32 +00:00
christos fa7b09b795 Merge in 2022g:
Although tzcode still works with C89, bugs found in recent routine
    maintenance indicate that bitrot has set in and that in practice
    C89 is no longer used to build tzcode.  As it is a maintenance
    burden, support for C89 is planned to be removed soon.  Instead,
    please use compilers compatible with C99, C11, C17, or C23.

    timegm, which tzcode implemented in 1989, will finally be
    standardized 34 years later as part of C23, so timegm is now
    supported even if STD_INSPIRED is not defined.

    Fix bug in zdump's tzalloc emulation on hosts that lack tm_zone.
    (Problem reported by Đoàn Trần Công Danh.)

    Fix bug in zic on hosts where malloc(0) yields NULL on success.
    (Problem reported by Tim McBrayer for AIX 6.1.)

    Fix zic configuration to avoid linkage failures on some platforms.
    (Problems reported by Gilmore Davidson and Igor Ivanov.)

    Work around MS-Windows nmake incompatibility with POSIX.
    (Problem reported by Manuela Friedrich.)

    Port mktime and strftime to debugging platforms where accessing
    uninitialized data has undefined behavior (strftime problem
    reported by Robert Elz).

    Check more carefully for unlikely integer overflows, preferring
    C23 <stdckdint.h> to overflow checking by hand, as the latter has
    had obscure bugs.
2022-12-11 17:57:23 +00:00
uwe 1c9bc64659 getbsize(3): Use .Ev for BLOCKSIZE 2022-12-06 00:13:17 +00:00
uwe e8b127922c getnetpath(3): Sprinkle some markup 2022-12-04 23:02:57 +00:00
jakllsch 78eb21a033 On VAX, compile gdtoa/misc.c at -O0 to avoid incorrect machine code
resulting in some doubles printing as garbage.
2022-12-04 22:35:15 +00:00
uwe 7440a63dca fcntl(2): Fix wrong markup in a couple of places 2022-12-04 19:01:19 +00:00
skrll 1beb9ce90d Consistently use the 'mv' instrucation (which is itself an alias) instead
of the (old) alternative alias 'move'.
2022-12-04 17:04:06 +00:00
uwe 495edbf836 re_format(7): Add subsection headings for ERE and BRE
The first paragraph could use some rewording.  While BRE may be
obsolete, it's still the default for regcomp(3) and the default for
grep(1), sed(1), etc.
2022-12-04 16:52:48 +00:00
uwe eff611cf1c Bump date for the fixed RETURN VALUES in previous 2022-12-04 16:21:54 +00:00
uwe 15c5c5f472 Tweak markup in _lwp_*(2) manual pages
Use .Rv where possible.  Some manual pages claimed that the error "is
returned", but RTFS and some quick testing indicate that this is wrong.

The commit message from 2003 says that:

  Note our current implementation mis-matches [man pages] slightly
  (error codes are stuffed into errno, where they should simply be
  returned by these calls).  This will be addressed shortly.

That hasn't happened in the 20 years, so we might as well make the man
pages reflect the reality.
2022-12-04 16:17:50 +00:00
uwe 49e10846a6 lib: Mark up error names in man pages with .Er 2022-12-04 11:25:08 +00:00
uwe 27e8188424 flock(2): s/Eq/Er/ typo in the ERRORS section 2022-12-04 11:18:58 +00:00
uwe e6fc3c59c2 Sections 2 and 3 have RETURN VALUES, not DIAGNOSTICS 2022-12-04 01:29:31 +00:00
uwe 254727163e getservent(3): Section 3 has RETURN VALUES, not DIAGNOSTICS
While here, don't claim that null pointer is zero.

We should probably just pick the wording from POSIX, but that yak is a
bit too big for me to shave at the moment.
2022-12-04 00:13:11 +00:00
jschauma 4556c7b6e8 reference /var/db/services.cdb / services_mkdb(8) 2022-12-03 23:55:52 +00:00
skrll ea00852af2 Trailing whitespace 2022-12-03 14:04:39 +00:00
skrll 7893424154 Trailing whitespace 2022-12-03 09:38:53 +00:00
skrll d2296b0783 Trailing whitespace 2022-11-30 04:35:53 +00:00
uwe f90210105d socketpair(2): Formatting nits 2022-11-29 20:50:37 +00:00
jschauma 12d9662bb2 document the only supported type protocol, document type flags
This uses language taken from OpenBSD's manual page.
2022-11-29 20:26:39 +00:00
gutteridge d671eab624 reallocarray.3: minor grammar and style tweaks 2022-11-27 20:17:20 +00:00
jakllsch cd0fbe0b1b Simply set HAVE_GETRANDOM to false on __APPLE__.
Addresses PR 57083.
2022-11-17 17:35:25 +00:00
christos cd2e09c9fd PR/57083: Jiaxun Yang: Fix build on MacOS/X which has <sys/random.h> but no
getrandom(3).
2022-11-16 19:38:08 +00:00
gutteridge 7eadd4d371 posix_openpt.3: add a history section 2022-11-15 22:17:53 +00:00
gutteridge 03e840b8d3 closefrom.3: add a history section 2022-11-10 00:47:01 +00:00
riastradh 3ead30d6ad regerror(3): Allow null errbuf if errbuf_size is zero.
The man page says:

   If errbuf_size is 0, errbuf is ignored but the return value is still
   correct.

POSIX says:

   If errbuf_size is 0, regerror() shall ignore the errbuf argument,
   and return the size of the buffer needed to hold the generated
   string.

   https://pubs.opengroup.org/onlinepubs/9699919799/functions/regerror.html

from enh@google.com
2022-11-05 11:33:55 +00:00
christos 9acefc396c Cleaner to use if/then/else rather than a ton of casts in the ternary operator. 2022-11-02 12:49:10 +00:00
christos 1e7378f887 Update to tzcode2022f
Changes to code

    zic now supports links to links regardless of input line order.
    For example, if Australia/Sydney is a Zone, the lines
      Link Australia/Canberra Australia/ACT
      Link Australia/Sydney Australia/Canberra
    now work correctly, even though the shell commands
      ln Australia/Canberra Australia/ACT
      ln Australia/Sydney Australia/Canberra
    would fail because the first command attempts to use a link
    Australia/Canberra that does not exist until after the second
    command is executed.  Previously, zic had unspecified behavior if
    a Link line's target was another link, and zic often misbehaved if
    a Link line's target was a later Link line.

    Fix line number in zic's diagnostic for a link to a link.

    Fix a bug that caused localtime to mishandle timestamps starting
    in the year 2438 when reading data generated by 'zic -b fat' when
    distant-future DST transitions occur at times given in standard
    time or in UT, not the usual case of local time.  This occurs when
    the corresponding .zi Rule lines specify DST transitions with TO
    columns of 'max' and AT columns that end in 's' or 'u'.  The
    number 2438 comes from the 32-bit limit in the year 2038, plus the
    400-year Gregorian cycle.  (Problem reported by Bradley White.)

    On glibc 2.34 and later, which optionally supports 64-bit time_t
    on platforms like x86 where time_t was traditionally 32 bits,
    default time_t to 64 instead of 32 bits.  This lets functions like
    localtime support timestamps after the year 2038, and fixes
    year-2038 problems in zic when accessing files dated after 2038.
    To continue to limit time_t to 32 bits on these platforms, use
    "make CFLAGS='-D_TIME_BITS=32'".

    In C code, do not enable large-file support on platforms like AIX
    and macOS that no longer need it now that tzcode does not use
    off_t or related functions like 'stat'.  Large-file support is
    still enabled by default on GNU/Linux, as it is needed for 64-bit
    time_t support.

    In C code, prefer C23 keywords to pre-C23 macros for alignof,
    bool, false, and true.  Also, use the following C23 features if
    available: __has_include, unreachable.

    zic no longer works around Qt bug 53071, as the relevant Qt
    releases have been out of support since 2019.  This change affects
    only fat TZif files, as thin files never had the workaround.

    zdump no longer modifies the environ vector when compiled on
    platforms lacking tm_zone or when compiled with -DUSE_LTZ=0.
    This avoid undefined behavior on POSIX platforms.
2022-10-29 13:55:50 +00:00
wiz dd8db24513 put reallocarray() in the public namespace
reallocarray() will be part of the next POSIX release, see
https://austingroupbugs.net/view.php?id=1218

adapt an errno value to match POSIX expectations

As discussed on tech-userlevel
2022-10-28 09:43:58 +00:00