wm: teppich

Download patch

ref: 87aea719c1983d7a9c5297d4a52630d8b8dbe5ea
parent: e59fdba360cf7884bcb964b4ee999fcf8aaad16a
author: mkf <mkf@cloud9p.org>
date: Sun Dec 3 15:48:21 EST 2023

pc/user.c: revert lastuser, use proper error name

--- a/pc/user.c
+++ b/pc/user.c
@@ -28,7 +28,7 @@
 checkpass(char *s)
 {
 	if(strlen(s) < PASSWD_MAX)
-		return INVALID_PASSWORD;
+		return INVALID_PASSWD;
 
 	return OK;
 }
@@ -46,7 +46,7 @@
 useradd(char *name, char *pass)
 {
 	ll_t *t;
-	user_t *u;
+	user_t *u, *lastuser;
 
 	if(checkname(name) != OK)
 		return nil;
@@ -63,6 +63,7 @@
 			return nil;
 		t = (ll_t*)t->next;
 	}
+	lastuser = u; /* needed for uid */
 
 	u = (user_t*)malloc(sizeof(user_t));
 	u->id = lastuser->id + 1;