else
{
rc->suggestions = find_usernames(first, middle, last);
- if (!rc->suggestions)
+ if (!rc->suggestions && errno)
{
com_err(whoami, errno, "in RIFO");
- reply(rc, INTERNAL_ERROR, "INIT", "c", NULL, "Out of memory");
+ reply(rc, INTERNAL_ERROR, "INIT", "c", NULL, error_message(errno));
return;
}
}
EXEC SQL SELECT COUNT(login) INTO :count FROM users
WHERE login = :username;
if (sqlca.sqlcode)
- return NULL;
+ {
+ errno = MR_DBMS_ERR;
+ return NULL;
+ }
if (count == 0)
{
EXEC SQL SELECT COUNT(name) INTO :count FROM list
WHERE name = :username;
if (sqlca.sqlcode)
- return NULL;
+ {
+ errno = MR_DBMS_ERR;
+ return NULL;
+ }
}
if (count == 0)
{
EXEC SQL SELECT COUNT(label) INTO :count FROM filesys
WHERE label = :username;
if (sqlca.sqlcode)
- return NULL;
+ {
+ errno = MR_DBMS_ERR;
+ return NULL;
+ }
}
if (count == 0)
;
}
+ /* unames will be NULL if we couldn't suggest a username. Clear
+ errno so the caller can distinguish this from an error case. */
+ errno = 0;
return unames;
}