X-Git-Url: http://erislabs.net/gitweb/?a=blobdiff_plain;f=tests%2Ftest-ftello.c;h=d66ea0ccb7dbf1d8f5b136232e36e6ac0b98a504;hb=b2b1b4208042f959acc8cbc9ec1da0cac0445492;hp=f87783fc26e569bacff292409680e4deb0e22798;hpb=cec93e99d19f54c8f310b8290bab9014891530e3;p=gnulib.git diff --git a/tests/test-ftello.c b/tests/test-ftello.c index f87783fc2..d66ea0ccb 100644 --- a/tests/test-ftello.c +++ b/tests/test-ftello.c @@ -25,9 +25,12 @@ #include int -main () +main (int argc, char **argv) { - /* This test assumes stdin is seekable. */ - off_t pos = ftello (stdin); - return pos < 0; + /* Assume stdin is seekable iff argc > 1. */ + int expected = argc > 1 ? 0 : -1; + /* Exit with success only if ftell/ftello agree. */ + off_t pos1 = ftello (stdin); + long pos2 = ftell (stdin); + return ! (pos1 == pos2 && pos1 == expected); }