projects
/
gnulib.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
NEWS.stable: log cherry-pick [27147dc]->[4c5d3e6] doc: update users.txt
[gnulib.git]
/
tests
/
test-getlogin_r.c
diff --git
a/tests/test-getlogin_r.c
b/tests/test-getlogin_r.c
index
68c6812
..
2a20fd9
100644
(file)
--- a/
tests/test-getlogin_r.c
+++ b/
tests/test-getlogin_r.c
@@
-1,5
+1,5
@@
/* Test of getting user name.
/* Test of getting user name.
- Copyright (C) 2010 Free Software Foundation, Inc.
+ Copyright (C) 2010
-2011
Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@
-35,11
+35,16
@@
main (void)
{
/* Test with a large enough buffer. */
char buf[1024];
{
/* Test with a large enough buffer. */
char buf[1024];
+ int err;
- if (getlogin_r (buf, sizeof (buf)) != 0)
+ err = getlogin_r (buf, sizeof (buf));
+ if (err != 0)
{
/* getlogin_r() fails when stdin is not connected to a tty. */
{
/* getlogin_r() fails when stdin is not connected to a tty. */
+ ASSERT (err == ENOTTY);
+#if !defined __hpux /* On HP-UX 11.11 it fails anyway. */
ASSERT (! isatty (0));
ASSERT (! isatty (0));
+#endif
fprintf (stderr, "Skipping test: stdin is not a tty.\n");
return 77;
}
fprintf (stderr, "Skipping test: stdin is not a tty.\n");
return 77;
}
@@
-73,7
+78,13
@@
main (void)
size_t i;
for (i = 0; i <= n; i++)
size_t i;
for (i = 0; i <= n; i++)
- ASSERT (getlogin_r (smallbuf, i) == ERANGE);
+ {
+ err = getlogin_r (smallbuf, i);
+ if (i == 0)
+ ASSERT (err == ERANGE || err == EINVAL);
+ else
+ ASSERT (err == ERANGE);
+ }
}
/* Test with a huge buffer. */
}
/* Test with a huge buffer. */