Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F141983178
D45567.id139973.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
5 KB
Referenced Files
None
Subscribers
None
D45567.id139973.diff
View Options
diff --git a/usr.bin/wall/ttymsg.c b/usr.bin/wall/ttymsg.c
--- a/usr.bin/wall/ttymsg.c
+++ b/usr.bin/wall/ttymsg.c
@@ -29,10 +29,10 @@
* SUCH DAMAGE.
*/
-
-#include <sys/procdesc.h>
#include <sys/types.h>
+#include <sys/procdesc.h>
#include <sys/uio.h>
+
#include <capsicum_helpers.h>
#include <dirent.h>
#include <err.h>
@@ -41,8 +41,8 @@
#include <paths.h>
#include <signal.h>
#include <stdio.h>
-#include <string.h>
#include <stdlib.h>
+#include <string.h>
#include <unistd.h>
#include "ttymsg.h"
@@ -74,8 +74,8 @@
p += 4;
if (strchr(p, '/') != NULL) {
/* A slash is an attempt to break security... */
- (void) snprintf(errbuf, sizeof(errbuf),
- "Too many '/' in \"%s\"", device);
+ (void)snprintf(errbuf, sizeof(errbuf), "Too many '/' in \"%s\"",
+ device);
return (errbuf);
}
@@ -83,10 +83,10 @@
* open will fail on slip lines or exclusive-use lines
* if not running as root; not an error.
*/
- if ((fd = open(device, O_WRONLY|O_NONBLOCK, 0)) < 0) {
+ if ((fd = open(device, O_WRONLY | O_NONBLOCK, 0)) < 0) {
if (errno == EBUSY || errno == EACCES)
return (NULL);
- (void) snprintf(errbuf, sizeof(errbuf), "%s: %s", device,
+ (void)snprintf(errbuf, sizeof(errbuf), "%s: %s", device,
strerror(errno));
return (errbuf);
}
@@ -105,7 +105,7 @@
if (wret >= 0) {
left -= wret;
if (iov != localiov) {
- bcopy(iov, localiov,
+ bcopy(iov, localiov,
iovcnt * sizeof(struct iovec));
iov = localiov;
}
@@ -121,27 +121,27 @@
continue;
}
if (caph_enter() < 0)
- err(1, "unable to enter capability mode");
+ err(1, "unable to enter capability mode");
if (errno == EWOULDBLOCK) {
int cpid;
- cpid = pdfork(&fd,0);
+ cpid = pdfork(&fd, 0);
if (cpid < 0) {
- (void) snprintf(errbuf, sizeof(errbuf),
+ (void)snprintf(errbuf, sizeof(errbuf),
"fork: %s", strerror(errno));
- (void) close(fd);
+ (void)close(fd);
return (errbuf);
}
- if (cpid) { /* parent */
- (void) close(fd);
+ if (cpid) { /* parent */
+ (void)close(fd);
return (NULL);
}
/* wait at most tmout seconds */
- (void) signal(SIGALRM, SIG_DFL);
- (void) signal(SIGTERM, SIG_DFL); /* XXX */
- (void) sigsetmask(0);
- (void) alarm((u_int)tmout);
- (void) fcntl(fd, F_SETFL, 0); /* clear O_NONBLOCK */
+ (void)signal(SIGALRM, SIG_DFL);
+ (void)signal(SIGTERM, SIG_DFL); /* XXX */
+ (void)sigsetmask(0);
+ (void)alarm((u_int)tmout);
+ (void)fcntl(fd, F_SETFL, 0); /* clear O_NONBLOCK */
continue;
}
/*
@@ -150,12 +150,12 @@
*/
if (errno == ENODEV || errno == EIO)
break;
- (void) close(fd);
- (void) snprintf(errbuf, sizeof(errbuf),
- "%s: %s", device, strerror(errno));
+ (void)close(fd);
+ (void)snprintf(errbuf, sizeof(errbuf), "%s: %s", device,
+ strerror(errno));
return (errbuf);
}
- (void) close(fd);
+ (void)close(fd);
return (NULL);
}
diff --git a/usr.bin/wall/wall.c b/usr.bin/wall/wall.c
--- a/usr.bin/wall/wall.c
+++ b/usr.bin/wall/wall.c
@@ -61,8 +61,8 @@
static struct wallgroup {
struct wallgroup *next;
- char *name;
- gid_t gid;
+ char *name;
+ gid_t gid;
} *grouplist;
static int nobanner;
static int mbufsize;
@@ -96,11 +96,11 @@
(void)setlocale(LC_CTYPE, "");
- /*
- * Cache NLS data, for strerror, for err(3), before entering capability
- * mode.
- */
- caph_cache_catpages();
+ /*
+ * Cache NLS data, for strerror, for err(3), before entering capability
+ * mode.
+ */
+ caph_cache_catpages();
while ((ch = getopt(argc, argv, "g:n")) != -1)
switch (ch) {
@@ -155,7 +155,8 @@
ingroup = 1;
else if ((grp = getgrgid(g->gid)) != NULL) {
for (np = grp->gr_mem; *np; np++) {
- if (strcmp(*np, utmp->ut_user) == 0) {
+ if (strcmp(*np,
+ utmp->ut_user) == 0) {
ingroup = 1;
break;
}
@@ -165,10 +166,9 @@
if (ingroup == 0)
continue;
}
- if ((p = ttymsg(&iov, 1, utmp->ut_line, 60*5)) != NULL)
+ if ((p = ttymsg(&iov, 1, utmp->ut_line, 60 * 5)) != NULL)
warnx("%s", p);
}
-
exit(0);
}
@@ -220,13 +220,12 @@
* in column 80, but that can't be helped.
*/
(void)fwprintf(fp, L"\r%79s\r\n", " ");
- (void)swprintf(lbuf, sizeof(lbuf)/sizeof(wchar_t),
- L"Broadcast Message from %s@%s",
- whom, hostname);
+ (void)swprintf(lbuf, sizeof(lbuf) / sizeof(wchar_t),
+ L"Broadcast Message from %s@%s", whom, hostname);
(void)fwprintf(fp, L"%-79.79S\007\007\r\n", lbuf);
- (void)swprintf(lbuf, sizeof(lbuf)/sizeof(wchar_t),
- L" (%s) at %d:%02d %s...", tty,
- lt->tm_hour, lt->tm_min, lt->tm_zone);
+ (void)swprintf(lbuf, sizeof(lbuf) / sizeof(wchar_t),
+ L" (%s) at %d:%02d %s...", tty, lt->tm_hour,
+ lt->tm_min, lt->tm_zone);
(void)fwprintf(fp, L"%-79.79S\r\n", lbuf);
}
(void)fwprintf(fp, L"%79s\r\n", " ");
@@ -240,7 +239,7 @@
err(1, "setegid failed");
}
cnt = 0;
- while (fgetws(lbuf, sizeof(lbuf)/sizeof(wchar_t), stdin)) {
+ while (fgetws(lbuf, sizeof(lbuf) / sizeof(wchar_t), stdin)) {
for (p = lbuf; (ch = *p) != L'\0'; ++p, ++cnt) {
if (ch == L'\r') {
putwc(L'\r', fp);
@@ -258,10 +257,13 @@
putwc(L'\n', fp);
cnt = 0;
}
- if (iswprint(ch) || iswspace(ch) || ch == L'\a' || ch == L'\b') {
+ if (iswprint(ch) || iswspace(ch) || ch == L'\a' ||
+ ch == L'\b') {
putwc(ch, fp);
} else {
- (void)swprintf(codebuf, sizeof(codebuf)/sizeof(wchar_t), L"<0x%X>", ch);
+ (void)swprintf(codebuf,
+ sizeof(codebuf) / sizeof(wchar_t),
+ L"<0x%X>", ch);
for (tmp = codebuf; *tmp != L'\0'; ++tmp) {
putwc(*tmp, fp);
if (++cnt == 79) {
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Thu, Jan 15, 12:15 PM (10 h, 19 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
27649769
Default Alt Text
D45567.id139973.diff (5 KB)
Attached To
Mode
D45567: wall(1): cappsicumizing wall
Attached
Detach File
Event Timeline
Log In to Comment