dvtm

dynamic virtual terminal manager - with my changes
git clone https://pi.duncano.de/git/dvtm.git
Log | Files | Refs | README | LICENSE

commit 1131ee696612934ced00cb8d1eb27436e680823d
parent 03fb2f67cf44efbf39fc08dc9659bf3034a25fb9
Author: Marc Andre Tanner <mat@brain-dump.org>
Date:   Sun, 12 Jun 2011 14:08:09 +0200

Remove realpath(3) wrapper

Passing in NULL as a second argument to realpath(3) which tells the
libc to allocate the required buffer is standardized in POSIX.1-2008.

This segfaults on Open and NetBSD. Fix your libc.

Signed-off-by: Marc Andre Tanner <mat@brain-dump.org>

Diffstat:
dvtm.c | 23+----------------------
1 file changed, 1 insertion(+), 22 deletions(-)

diff --git a/dvtm.c b/dvtm.c @@ -1204,27 +1204,6 @@ usage() { exit(EXIT_FAILURE); } -/* glibc has a non-standard realpath(3) implementation which allocates - * the destination buffer, other C libraries may have a broken implementation - * which expect an already allocated destination buffer. - */ - -#ifndef __GLIBC__ -# include <limits.h> -# ifndef PATH_MAX -# define PATH_MAX 1024 -# endif -#endif - -static char *get_realpath(const char *path) { -#ifdef __GLIBC__ - return realpath(path, NULL); -#else - static char buf[PATH_MAX]; - return realpath(path, buf); -#endif -} - static bool parse_args(int argc, char *argv[]) { int arg; @@ -1273,7 +1252,7 @@ parse_args(int argc, char *argv[]) { case 'c': { const char *fifo; cmdfifo.fd = open_or_create_fifo(argv[++arg], &cmdfifo.file); - if (!(fifo = get_realpath(argv[arg]))) + if (!(fifo = realpath(argv[arg], NULL))) error("%s\n", strerror(errno)); setenv("DVTM_CMD_FIFO", fifo, 1); break;