Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F162833115
D51876.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
1 KB
Referenced Files
None
Subscribers
None
D51876.diff
View Options
diff --git a/usr.bin/last/last.c b/usr.bin/last/last.c
--- a/usr.bin/last/last.c
+++ b/usr.bin/last/last.c
@@ -433,15 +433,15 @@
return (YES);
break;
case HOST_TYPE:
- if (!strcasecmp(step->name, bp->ut_host))
+ if (strcasecmp(step->name, bp->ut_host) == 0)
return (YES);
break;
case TTY_TYPE:
- if (!strcmp(step->name, bp->ut_line))
+ if (strcmp(step->name, bp->ut_line) == 0)
return (YES);
break;
case USER_TYPE:
- if (!strcmp(step->name, bp->ut_user))
+ if (strcmp(step->name, bp->ut_user) == 0)
return (YES);
break;
}
@@ -478,7 +478,7 @@
static char *hostdot, name[MAXHOSTNAMELEN];
char *argdot;
- if (!(argdot = strchr(arg, '.')))
+ if ((argdot = strchr(arg, '.')) == NULL)
return;
if (first) {
first = 0;
@@ -486,7 +486,7 @@
xo_err(1, "gethostname");
hostdot = strchr(name, '.');
}
- if (hostdot && !strcasecmp(hostdot, argdot))
+ if (hostdot != NULL && strcasecmp(hostdot, argdot) == 0)
*argdot = '\0';
}
@@ -504,19 +504,16 @@
* a two character suffix.
*/
if (strlen(arg) == 2) {
- /* either 6 for "ttyxx" or 8 for "console" */
- if ((mval = malloc(8)) == NULL)
+ if (strcmp(arg, "co") == 0)
+ mval = strdup("console");
+ else
+ asprintf(&mval, "tty%s", arg);
+ if (mval == NULL)
xo_errx(1, "malloc failure");
- if (!strcmp(arg, "co"))
- (void)strcpy(mval, "console");
- else {
- (void)strcpy(mval, "tty");
- (void)strcpy(mval + 3, arg);
- }
return (mval);
}
- if (!strncmp(arg, _PATH_DEV, sizeof(_PATH_DEV) - 1))
- return (arg + 5);
+ if (strncmp(arg, _PATH_DEV, strlen(_PATH_DEV)) == 0)
+ return (arg + strlen(_PATH_DEV));
return (arg);
}
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sat, Jul 18, 9:35 AM (8 h, 1 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
35194538
Default Alt Text
D51876.diff (1 KB)
Attached To
Mode
D51876: last: Mild style cleanup
Attached
Detach File
Event Timeline
Log In to Comment