#include <string.h>
#include <unistd.h>
#include <errno.h>
-#include <error.h>
#include <inttypes.h>
#include <sys/inotify.h>
#include <sys/fcntl.h>
/* nonblocking inotify should return immediately with no events */
ret = read(ifd, &e, sizeof(e));
if (ret != -1 || errno != EAGAIN) {
- error(0, 0, "first read() returned %d", ret);
+ fprintf(stderr, "first read() returned %d\n", ret);
result = 1;
}
/* now check whether our event was seen */
ret = read(ifd, &e, sizeof(e));
if (ret != sizeof(e)) {
- error(0, 0, "second read() returned %d", ret);
+ fprintf(stderr, "second read() returned %d\n", ret);
result = 1;
}
if (!(e.mask & IN_DELETE_SELF)) {
- error(0, 0, "incorrect event mask: %" PRIx32, e.mask);
+ fprintf(stderr, "incorrect event mask: %" PRIx32 "\n", e.mask);
result = 1;
}
<http://www.gnu.org/licenses/>. */
#include <errno.h>
-#include <error.h>
#include <stdlib.h>
#include <string.h>
#include <sys/types.h>
/* Open our test file. */
fd = mkstemp (name);
- if (fd == -1)
- error (EXIT_FAILURE, errno, "cannot open test file `%s'", name);
+ if (fd == -1) {
+ fprintf (stderr, "cannot open test file `%s': ", name);
+ perror (NULL);
+ exit (EXIT_FAILURE);
+ }
}
struct utmp entry[] =
{
if (pututline (&entry[n]) == NULL)
{
- error (0, errno, "cannot write UTMP entry");
+ perror ("cannot write UTMP entry");
return 1;
}
}
if (n < num_entries &&
memcmp (ut, &entry[n], sizeof (struct utmp)))
{
- error (0, 0, "UTMP entry does not match");
+ fprintf (stderr, "UTMP entry does not match\n");
return 1;
}
if (n != num_entries)
{
- error (0, 0, "number of UTMP entries is incorrect");
+ fprintf (stderr, "number of UTMP entries is incorrect\n");
return 1;
}
if (pututline (&entry[n]) == NULL)
{
- error (0, errno, "cannot write UTMP entry");
+ perror ("cannot write UTMP entry");
return 1;
}
}
}
- error (0, 0, "no entries available");
+ fprintf (stderr, "no entries available\n");
return 1;
}
if (pututline (&entry[n]) == NULL)
{
- error (0, errno, "cannot write UTMP entry");
+ perror ("cannot write UTMP entry");
return 1;
}
}
}
- error (0, 0, "no entry found for `%s'", line);
+ fprintf (stderr, "no entry found for `%s'\n", line);
return 1;
}
up = getutline (&ut);
if (up == NULL)
{
- error (0, errno, "cannot get entry for line `%s'", line);
+ fprintf (stderr, "cannot get entry for line `%s': ", line);
+ perror(NULL);
return 1;
}
{
if (memcmp (up, &entry[n], sizeof (struct utmp)))
{
- error (0, 0, "UTMP entry does not match");
+ fprintf (stderr, "UTMP entry does not match\n");
return 1;
}
}
}
- error (0, 0, "bogus entry for line `%s'", line);
+ fprintf (stderr, "bogus entry for line `%s'\n", line);
return 1;
}
strcpy (ut.ut_line, line);
if (getutline (&ut) != NULL)
{
- error (0, 0, "bogus login entry for `%s'", line);
+ fprintf (stderr, "bogus login entry for `%s'\n", line);
return 1;
}
up = getutid (&ut);
if (up == NULL)
{
- error (0, errno, "cannot get entry for ID `%s'", id);
+ fprintf (stderr, "cannot get entry for ID `%s': ", id);
+ perror (NULL);
return 1;
}
{
if (memcmp (up, &entry[n], sizeof (struct utmp)))
{
- error (0, 0, "UTMP entry does not match");
+ fprintf (stderr, "UTMP entry does not match\n");
return 1;
}
}
}
- error (0, 0, "bogus entry for ID `%s'", id);
+ fprintf (stderr, "bogus entry for ID `%s'\n", id);
return 1;
}
up = getutid (&ut);
if (up == NULL)
{
- error (0, errno, "cannot get entry for type `%d'", type);
+ fprintf (stderr, "cannot get entry for type `%d': ", type);
+ perror (NULL);
return 1;
}
{
if (memcmp (up, &entry[n], sizeof (struct utmp)))
{
- error (0, 0, "UTMP entry does not match");
+ fprintf (stderr, "UTMP entry does not match\n");
return 1;
}
}
}
- error (0, 0, "bogus entry for type `%d'", type);
+ fprintf (stderr, "bogus entry for type `%d'\n", type);
return 1;
}