summaryrefslogtreecommitdiff
path: root/build-aux/useless-if-before-free
diff options
context:
space:
mode:
Diffstat (limited to 'build-aux/useless-if-before-free')
-rwxr-xr-xbuild-aux/useless-if-before-free20
1 files changed, 17 insertions, 3 deletions
diff --git a/build-aux/useless-if-before-free b/build-aux/useless-if-before-free
index 6d6b8d4199..0701e7b20b 100755
--- a/build-aux/useless-if-before-free
+++ b/build-aux/useless-if-before-free
@@ -1,6 +1,20 @@
-eval '(exit $?0)' && eval 'exec perl -wST "$0" "$@"'
- & eval 'exec perl -wST "$0" $argv:q'
- if 0;
+#!/bin/sh
+#! -*-perl-*-
+# This is a prologue that allows to run a perl script as an executable
+# on systems that are compliant to a POSIX version before POSIX:2017.
+# On such systems, the usual invocation of an executable through execlp()
+# or execvp() fails with ENOEXEC if it is a script that does not start
+# with a #! line. The script interpreter mentioned in the #! line has
+# to be /bin/sh, because on GuixSD systems that is the only program that
+# has a fixed file name. The second line is for editing this file in
+# Emacs. The next two lines below are valid code in both sh and perl.
+# When executed by sh, they re-execute the script through the perl
+# program found in $PATH. The '-x' option is essential; without it,
+# perl would re-execute the script through /bin/sh. When executed by
+# perl, the next two lines are a no-op.
+eval 'exec perl -wSx "$0" "$@"'
+ if 0;
+
# Detect instances of "if (p) free (p);".
# Likewise "if (p != 0)", "if (0 != p)", or with NULL; and with braces.