]> arthur.barton.de Git - bup.git/commit
lib/cmd/bup.c: Accomodate historical realpath
authorGreg Troxel <gdt@lexort.com>
Tue, 12 Jul 2022 19:08:46 +0000 (19:08 +0000)
committerRob Browning <rlb@defaultvalue.org>
Sat, 20 Aug 2022 17:20:43 +0000 (12:20 -0500)
commit425d2ad2ee8013d9bbc65d5727dae27bb323857a
treeb359d3eee29e3c495b05a04e6ed15de14c3ab8ae
parent3914d75c42f60d71ace4957bd31d3009d9f8ed0c
lib/cmd/bup.c: Accomodate historical realpath

realpath(3) originally required a non-NULL 2nd argument.  POSIX
extended it to allow NULL, but some old BSD versions still have the
as-first-introduced-in-4.4BSD implementation that does not accept the
2nd argument being NULL.

Define bup_realpath, which collapses to just system realpath for most
systems, and on systems known to have historic realpath, use a buffer,
and strdup the results, to match the POSIX-with-NULL semantics.

This should fix NetBSD and OpenBSD, and realpath isn't used on
FreeBSD.  This does not attempt to address Solaris.

Signed-off-by: Greg Troxel <gdt@lexort.com>
Reviewed-by: Rob Browning <rlb@defaultvalue.org>
[rlb@defaultvalue.org: adjust commit message]
[rlb@defaultvalue.org: change #define to BUP_HAVE_POSIX_REALPATH]
[rlb@defaultvalue.org: add OpenBSD version guard clause]
[rlb@defaultvalue.org: nest NetBSD checks so Prereq doesn't crash elsewhere]
[rlb@defaultvalue.org: reformat bup_realpath a bit]
Signed-off-by: Rob Browning <rlb@defaultvalue.org>
Tested-by: Rob Browning <rlb@defaultvalue.org>
lib/cmd/bup.c