From: guenther Date: Mon, 9 Jan 2023 02:12:13 +0000 (+0000) Subject: setthrname() should return EINVAL, not ENAMETOOLONG, when the X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=574d834c63d1b766bafc91fce3df6b3780b61144;p=openbsd setthrname() should return EINVAL, not ENAMETOOLONG, when the input is too long. ok mpi@ --- diff --git a/sys/kern/kern_prot.c b/sys/kern/kern_prot.c index 54e169debbb..a2b22cd760a 100644 --- a/sys/kern/kern_prot.c +++ b/sys/kern/kern_prot.c @@ -1,4 +1,4 @@ -/* $OpenBSD: kern_prot.c,v 1.81 2023/01/07 05:24:58 guenther Exp $ */ +/* $OpenBSD: kern_prot.c,v 1.82 2023/01/09 02:12:13 guenther Exp $ */ /* $NetBSD: kern_prot.c,v 1.33 1996/02/09 18:59:42 christos Exp $ */ /* @@ -1157,6 +1157,8 @@ sys_setthrname(struct proc *curp, void *v, register_t *retval) error = copyinstr(SCARG(uap, name), buf, sizeof buf, NULL); if (error == 0) strlcpy(p->p_name, buf, sizeof(p->p_name)); + else if (error == ENAMETOOLONG) + error = EINVAL; *retval = error; return 0; }