Added set_error() API to have a single point of entry for setting for errno and errstr.
[akaros.git] / kern / src / ns / dev.c
index 9fa47e0..a2db8bf 100644 (file)
@@ -218,8 +218,7 @@ Accept:
 Notfound:
                                        if (j == 0)
                                                error(ENODEV, NULL);
-                                       set_errno(ENOENT);
-                                       set_errstr(errno_to_string(ENOENT));
+                                       set_error(ENOENT, NULL);
                                        goto Done;
                                case 0:
                                        printd("DEVWALK continue, i was %d\n", i);
@@ -388,7 +387,7 @@ struct chan *devopen(struct chan *c, int omode, struct dirtab *tab, int ntab,
 Return:
        c->offset = 0;
        if ((c->qid.type & QTDIR) && (omode & O_WRITE))
-               error(EFAIL, "Tried opening dir with non-read-only mode %o", omode);
+               error(EACCES, "Tried opening dir with non-read-only mode %o", omode);
        c->mode = openmode(omode);
        c->flag |= COPEN;
        return c;