]> git.ipfire.org Git - thirdparty/libbsd.git/commitdiff
test: Handle libtool executable names in getprogname() unit test
authorGuillem Jover <guillem@hadrons.org>
Mon, 19 Jun 2017 19:32:01 +0000 (21:32 +0200)
committerGuillem Jover <guillem@hadrons.org>
Sat, 24 Jun 2017 14:05:50 +0000 (16:05 +0200)
Sometimes libtool will prefix the test programs with "lt-", we should
handle these and strip the prefix.

Fixes: https://bugs.debian.org/865090
test/progname.c

index d6d0a733d814f690be3a6b9d4376bf67b6c0bb52..811bcdb2f5be1e278f8346783d9f795625bad2e3 100644 (file)
 int
 main(int argc, char **argv)
 {
-       assert(strcmp(getprogname(), "progname") == 0);
+       const char *progname;
+
+       progname = getprogname();
+       if (strncmp(progname, "lt-", 3) == 0)
+               progname += 3;
+       assert(strcmp(progname, "progname") == 0);
 
        setprogname("program-name");
        assert(strcmp(getprogname(), "program-name") == 0);