Fix system calls returning errno values instead of setting errno.

This commit is contained in:
Jonas 'Sortie' Termansen 2023-04-06 16:39:15 +02:00
parent eeea3bdcc6
commit cb88c18bf0
5 changed files with 6 additions and 6 deletions

View File

@ -608,7 +608,7 @@ int Descriptor::utimens(ioctx_t* ctx, const struct timespec* user_times)
return -1;
if ( !valid_utimens_timespec(times[0]) ||
!valid_utimens_timespec(times[1]) )
return errno = EINVAL;
return errno = EINVAL, -1;
// TODO: Regardless of dflags, check if the user/group can utimens.
return vnode->utimens(ctx, times);
}

View File

@ -282,7 +282,7 @@ int sys_ftruncate(int fd, off_t length)
int sys_fstatat(int dirfd, const char* path, struct stat* st, int flags)
{
if ( flags & ~(AT_SYMLINK_NOFOLLOW) )
return errno = EINVAL;
return errno = EINVAL, -1;
char* pathcopy = GetStringFromUser(path);
if ( !pathcopy )
return -1;
@ -319,7 +319,7 @@ int sys_fstatvfs(int fd, struct statvfs* stvfs)
int sys_fstatvfsat(int dirfd, const char* path, struct statvfs* stvfs, int flags)
{
if ( flags & ~(AT_SYMLINK_NOFOLLOW) )
return errno = EINVAL;
return errno = EINVAL, -1;
char* pathcopy = GetStringFromUser(path);
if ( !pathcopy )
return -1;

View File

@ -2016,7 +2016,7 @@ ssize_t TCPSocket::send_unlocked(ioctx_t* ctx,
if ( sockerr )
return errno = sockerr, -1;
if ( ctx->dflags & O_NONBLOCK )
return errno = EWOULDBLOCK;
return errno = EWOULDBLOCK, -1;
if ( !kthread_cond_wait_signal(&transmit_cond, &tcp_lock) )
return errno = EINTR, -1;
}

View File

@ -114,7 +114,7 @@ int sys_sigaction(int signum,
struct sigaction* user_oldact)
{
if ( signum < 0 || signum == 0 /* null signal */ || SIG_MAX_NUM <= signum )
return errno = EINVAL;
return errno = EINVAL, -1;
Process* process = CurrentProcess();
ScopedLock lock(&process->signal_lock);

View File

@ -760,7 +760,7 @@ int TTY::tcflow(ioctx_t* /*ctx*/, int action)
case TCOON: break; // TODO: Resume suspended output.
case TCIOFF: break; // TODO: Transmit STOP character.
case TCION: break; // TODO: Transmit START character.
default: return errno = EINVAL -1;
default: return errno = EINVAL, -1;
}
return 0;
}