summaryrefslogtreecommitdiff
path: root/usr/src/cmd
diff options
context:
space:
mode:
authorGary Mills <gary_mills@fastmail.fm>2015-03-07 16:16:39 -0600
committerRobert Mustacchi <rm@joyent.com>2015-03-11 12:12:20 -0700
commitb9c817386d7607f906fe86b2b0f46bcfe80cf82d (patch)
treee0117913e9a8425cc2d3410e631cdca4ff0d22df /usr/src/cmd
parentb00681c89badc9c4b5dff8af3603e008b0cedd98 (diff)
downloadillumos-gate-b9c817386d7607f906fe86b2b0f46bcfe80cf82d.tar.gz
5613 odd ls -U behaviour if output is not a terminal
Reviewed by: Dan McDonald <danmcd@omniti.com> Reviewed by: Hans Rosenfeld <hans.rosenfeld@nexenta.com> Approved by: Robert Mustacchi <rm@joyent.com>
Diffstat (limited to 'usr/src/cmd')
-rw-r--r--usr/src/cmd/ls/ls.c24
1 files changed, 9 insertions, 15 deletions
diff --git a/usr/src/cmd/ls/ls.c b/usr/src/cmd/ls/ls.c
index 43b2155444..1adab128a4 100644
--- a/usr/src/cmd/ls/ls.c
+++ b/usr/src/cmd/ls/ls.c
@@ -22,6 +22,7 @@
/*
* Copyright (c) 1988, 2010, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2012, Joyent, Inc. All rights reserved.
+ * Copyright 2015 Gary Mills
*/
/*
@@ -1260,7 +1261,8 @@ pentry(struct lbuf *ap)
char *str;
if (noflist) {
- (void) printf("%s\n", ap->ln.lname);
+ (void) printf("%s\n", (ap->lflags & ISARG) ? ap->ln.namep :
+ ap->ln.lname);
return;
}
@@ -1811,30 +1813,22 @@ gstat(char *file, int argfl, struct ditem *myparent)
rep = flist[nfiles++];
}
+ /* Clear the lbuf */
+ (void) memset((void *) rep, 0, sizeof (struct lbuf));
+
/*
* When noflist is set, none of the extra information about the dirent
- * will be printed, so omit initialization of this lbuf as well as the
- * stat(2) call.
+ * will be printed, so omit remaining initialization of this lbuf
+ * as well as the stat(2) call.
*/
if (!argfl && noflist)
return (rep);
- /* Initialize */
+ /* Initialize non-zero members */
- rep->lflags = (mode_t)0;
- rep->flinkto = NULL;
- rep->cycle = 0;
rep->lat.tv_sec = time(NULL);
- rep->lat.tv_nsec = 0;
rep->lct.tv_sec = time(NULL);
- rep->lct.tv_nsec = 0;
rep->lmt.tv_sec = time(NULL);
- rep->lmt.tv_nsec = 0;
- rep->aclp = NULL;
- rep->exttr = NULL;
- rep->extm = NULL;
- rep->color = NULL;
- rep->link_color = NULL;
if (argfl || statreq) {
int doacl;