Skip to content

Commit

Permalink
tst-varlink: fix order of error checking
Browse files Browse the repository at this point in the history
  • Loading branch information
thkukuk committed Jan 28, 2025
1 parent 449eca0 commit bad056a
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions tests/tst-varlink.c
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/* SPDX-License-Identifier: BSD-2-Clause
Copyright (c) 2023, Thorsten Kukuk <[email protected]>
Copyright (c) 2024, 2025 Thorsten Kukuk <[email protected]>
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
Expand Down Expand Up @@ -69,17 +69,18 @@ main(void)
if ((id = wtmpdb_login ("varlink", USER_PROCESS, user,
login_t, tty, rhost, service, &error)) < 0)
{
if (id == -ECONNREFUSED || id == -ENOENT ||
id == -EACCES || id == -EPROTONOSUPPORT)
return 77;

if (error)
{
fprintf (stderr, "wtmpdb_login: %s\n", error);
free (error);
}
else
fprintf (stderr, "wtmpdb_login failed (%li)\n", id);

if (id == -ECONNREFUSED || id == -ENOENT ||
id == -EACCES || id == -EPROTONOSUPPORT)
return 77;

return 1;
}
printf ("wtmpdb_login id: %li\n", id);
Expand Down

0 comments on commit bad056a

Please sign in to comment.