return(NULL);
if((transfer->endpos >= 0) && (transfer->curpos + *size >= transfer->endpos))
{
- *size = transfer->endpos - transfer->curpos;
- buf = srealloc(buf, *size);
+ if((*size = transfer->endpos - transfer->curpos) == 0) {
+ free(buf);
+ buf = NULL;
+ } else {
+ buf = srealloc(buf, *size);
+ }
}
transfer->curpos += *size;
bytesupload += *size;
dc_freewcsarr(toks);
if(cmd != NULL)
free(cmd);
- return(scm_from_int(tag));
+ if(tag == -1) {
+ if(errno == ENOSYS) {
+ scm_error(scm_str2symbol("no-such-cmd"), "dc-qcmd", "Invalid command name", SCM_EOL, SCM_BOOL_F);
+ } else if(errno == EINVAL) {
+ scm_error(scm_str2symbol("illegal-escape"), "dc-qcmd", "Invalid escape sequence", SCM_EOL, SCM_BOOL_F);
+ } else {
+ scm_syserror("dc-qcmd");
+ }
+ } else {
+ return(scm_from_int(tag));
+ }
}
static void login_scmcb(int err, wchar_t *reason, struct scmcb *scmcb)
if((cmd->name != NULL) && !wcscmp(cmd->name, name))
break;
}
- if(cmd == NULL)
+ if(cmd == NULL) {
+ errno = ENOSYS; /* Bleh */
return(NULL);
+ }
}
new = smalloc(sizeof(*new));
new->tag = tag++;
} else {
if(buf != NULL)
free(buf);
+ errno = EINVAL;
return(-1);
}
} else {