aboutsummaryrefslogtreecommitdiffstats
path: root/src/sysdeps/tryprocselfexe.c
blob: e8b8a88b387defd6a66d2e2084595659c3e9c231 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
/* ISC license */

#include <unistd.h>
#include <stdlib.h>
#include <errno.h>

int main (int argc, char const *const *argv)
{
  char buf[8192] ;
  if (argc < 2) return 111 ;
  ssize_t r = readlink(argv[1], buf, 8192) ;
  return r == -1 ? errno == EIO || errno == ELOOP ? 111 : 1 : r <= 1 ;
}