Date: Tue, 1 Apr 2014 18:51:24 +0400 From: Sergey Kandaurov <pluknet@freebsd.org> To: Bryan Drewery <bdrewery@freebsd.org> Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org, Mateusz Guzik <mjg@freebsd.org>, owner-src-committers@freebsd.org Subject: Re: svn commit: r263981 - in head: lib/libc/gen sys/kern sys/sys Message-ID: <CAE-mSO%2BAe6q-c7ugHOKgR6AtGvWZi9i=gJyG03s04xHpCPB2bg@mail.gmail.com> In-Reply-To: <8fec12199b9480cbf1abaea126fa264e@shatow.net> References: <20140401012455.GA26117@dft-labs.eu> <8fec12199b9480cbf1abaea126fa264e@shatow.net>
next in thread | previous in thread | raw e-mail | index | archive | help
On 1 April 2014 18:45, Bryan Drewery <bdrewery@freebsd.org> wrote: > On 2014-03-31 20:24, Mateusz Guzik wrote: >> >> Author: mjg >> Date: Tue Apr 1 03:20:35 2014 >> >> New Revision: 263981 >> URL: http://svnweb.freebsd.org/changeset/base/263981 >> >> Log: >> Add a new errno: EMACS - Editor too big. >> >> Make a best-effort to detect that Emacs is about to executed and return >> the error. >> >> MFC after: 1 week >> >> Modified: >> head/lib/libc/gen/errlst.c >> head/sys/kern/kern_exec.c >> head/sys/sys/errno.h >> >> Modified: lib/libc/gen/errlst.c >> =================================================================== >> --- head/lib/libc/gen/errlst.c (263980) >> +++ head/lib/libc/gen/errlst.c (263981) >> @@ -155,6 +155,7 @@ >> "Not permitted in capability mode", /* 94 - ECAPMODE */ >> "State not recoverable", /* 95 - ENOTRECOVERABLE */ >> "Previous owner died", /* 96 - EOWNERDEAD */ >> + "Editor too big", /* 97 - EMACS */ >> }; >> const int sys_nerr = sizeof(sys_errlist) / sizeof(sys_errlist[0]); >> >> Modified: sys/kern/kern_exec.c >> =================================================================== >> --- head/sys/kern/kern_exec.c (263980) >> +++ head/sys/kern/kern_exec.c (263981) >> @@ -337,6 +337,7 @@ >> int (*img_first)(struct image_params *); >> struct pargs *oldargs = NULL, *newargs = NULL; >> struct sigacts *oldsigacts, *newsigacts; >> + char *e; >> #ifdef KTRACE >> struct vnode *tracevp = NULL; >> struct ucred *tracecred = NULL; >> @@ -418,6 +419,19 @@ >> >> SDT_PROBE(proc, kernel, , exec, args->fname, 0, 0, 0, 0 ); >> >> + /* >> + * A best-effort to check whether the file to be run is EMACS >> + */ >> + if (args->fname != NULL) { >> + e = args->fname + strlen(args->fname); >> + while (e > args->fname && *e != '/') >> + e--; >> + if (strcasecmp(e, "/emacs") == 0) { >> + error = EMACS; >> + goto exec_fail; >> + } >> + } >> + >> interpret: >> if (args->fname != NULL) { >> #ifdef CAPABILITY_MODE >> Modified: sys/sys/errno.h >> =================================================================== >> --- head/sys/sys/errno.h (263980) >> +++ head/sys/sys/errno.h (263981) >> @@ -178,10 +178,11 @@ >> #define ECAPMODE 94 /* Not permitted in >> capability mode */ >> #define ENOTRECOVERABLE 95 /* State not recoverable >> */ >> #define EOWNERDEAD 96 /* Previous owner died */ >> +#define EMACS 97 /* Editor too big */ >> #endif /* _POSIX_SOURCE */ >> >> #ifndef _POSIX_SOURCE >> -#define ELAST 96 /* Must be equal largest >> errno */ >> +#define ELAST 97 /* Must be equal largest >> errno */ >> #endif /* _POSIX_SOURCE */ >> >> #ifdef _KERNEL > > > Don't forget errno(2): > As well as lib/libc/nls/C.msg -- wbr, pluknet
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?CAE-mSO%2BAe6q-c7ugHOKgR6AtGvWZi9i=gJyG03s04xHpCPB2bg>