apsun / loliOS

Lightweight & operational Linux-inspired OS.
33 stars 1 forks source link

Correctly propagate error codes #32

Open apsun opened 2 years ago

apsun commented 2 years ago

A lot of code in the kernel uses the following pattern:

if (fn() < 0) {
    return -1;
}

This discards the error code and replaces it with a generic -1. If we ever want to start returning proper error codes like EINVAL, ENOMEM, etc, we need to replace this with:

if ((ret = fn()) < 0) {
    return ret;
}