]> git.ipfire.org Git - thirdparty/util-linux.git/blame - tools/checkxalloc.sh
lib/pty: reset mainloop timeout on signal
[thirdparty/util-linux.git] / tools / checkxalloc.sh
CommitLineData
e1e7be22
DR
1#!/bin/sh
2#
3# Find files which include the xalloc.h header, but which still call
4# the unwrapped calloc and malloc.
5#
6
7cd "$(git rev-parse --show-toplevel)" || {
8 echo "error: failed to chdir to git root"
9 exit 1
10}
11
12git grep -zl '#include "xalloc.h"' |
99d618c0 13 xargs -0 grep -nE '\b(([cm]|re)alloc|strdup|asprintf)[[:space:]]*\([^)]'
d05a3e97
KZ
14
15result=$?
16
17if [ $result -eq 123 ]; then
18 exit 0 # not found
19elif [ $result -eq 0 ]; then
20 exit 1 # found
21fi
22
23exit $result