#include <errno.h>
#include <fcntl.h>
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
int main(int argc, char **argv) {
size_t i;
int open_max;
open_max = sysconf(_SC_OPEN_MAX);
if (open_max < 0)
return EXIT_FAILURE;
for (i = 0; i < open_max; i++) {
int f;
int closed;
closed = fcntl(i, F_GETFD, &f) == -1 &&
errno == EBADF;
if (!closed)
}
return EXIT_SUCCESS;
}
CiNpbmNsdWRlIDxlcnJuby5oPgojaW5jbHVkZSA8ZmNudGwuaD4KI2luY2x1ZGUgPHN0ZGlvLmg+CiNpbmNsdWRlIDxzdGRsaWIuaD4KI2luY2x1ZGUgPHVuaXN0ZC5oPgoKaW50IG1haW4oaW50IGFyZ2MsIGNoYXIgKiphcmd2KSB7CiAgICBzaXplX3QgaTsKICAgIGludCBvcGVuX21heDsKCiAgICBvcGVuX21heCA9IHN5c2NvbmYoX1NDX09QRU5fTUFYKTsKICAgIGlmIChvcGVuX21heCA8IDApCiAgICAgICAgcmV0dXJuIEVYSVRfRkFJTFVSRTsKICAgIGZvciAoaSA9IDA7IGkgPCBvcGVuX21heDsgaSsrKSB7CiAgICAgICAgaW50IGY7CiAgICAgICAgaW50IGNsb3NlZDsKICAgICAgICBjbG9zZWQgPSBmY250bChpLCBGX0dFVEZELCAmZikgPT0gLTEgJiYKICAgICAgICAgICAgZXJybm8gPT0gRUJBREY7CiAgICAgICAgaWYgKCFjbG9zZWQpCiAgICAgICAgICAgIHByaW50ZigiRkQ6JXp1XG4iLCBpKTsKICAgIH0KCiAgICByZXR1cm4gRVhJVF9TVUNDRVNTOwp9Cg==