used when read from device returns no data but no underlying error
"operation would block",
"invalid command for operation",
"expected only one YubiKey but several present",
+ "no data returned from device",
};
const char *yk_strerror(int errnum)
{
#define YK_EWOULDBLOCK 0x0b /* operation would block */
#define YK_EINVALIDCMD 0x0c /* supplied command is invalid for this operation */
#define YK_EMORETHANONE 0x0d /* expected to find only one key but found more */
+#define YK_ENODATA 0x0e /* no data was returned from a read */
/* Flags for response reading. Use high numbers to not exclude the possibility
* to combine these with for example SLOT commands from ykdef.h in the future.
if (ykl_errno > 0 && rc2 < 0)
ykl_errno = rc2;
}
- if (ykl_errno > 0)
+ if (ykl_errno > 0) {
return ykl_errno;
- yk_errno = YK_EUSBERR;
+ } else if(ykl_errno == 0) {
+ yk_errno = YK_ENODATA;
+ } else {
+ yk_errno = YK_EUSBERR;
+ }
return 0;
}
}
if (rc >= 0)
return rc;
- yk_errno = YK_EUSBERR;
+ if(rc == 0)
+ yk_errno = YK_ENODATA;
+ else
+ yk_errno = YK_EUSBERR;
return 0;
}
return 0;
}
+ if(sizecf == 0)
+ yk_errno = YK_ENODATA;
+
return (int)sizecf;
}