Print this page
5613 odd ls -U behaviour if output is not a terminal
*** 20,29 ****
--- 20,30 ----
*/
/*
* Copyright (c) 1988, 2010, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2012, Joyent, Inc. All rights reserved.
+ * Copyright 2015 Gary Mills
*/
/*
* Copyright 2009 Jason King. All rights reserved.
* Use is subject to license terms.
*** 1258,1268 ****
char *dmark = ""; /* Used if -p or -F option active */
char *cp;
char *str;
if (noflist) {
! (void) printf("%s\n", ap->ln.lname);
return;
}
p = ap;
column();
--- 1259,1270 ----
char *dmark = ""; /* Used if -p or -F option active */
char *cp;
char *str;
if (noflist) {
! (void) printf("%s\n", (ap->lflags & ISARG) ? ap->ln.namep :
! ap->ln.lname);
return;
}
p = ap;
column();
*** 1809,1842 ****
maxn = nfiles;
} else {
rep = flist[nfiles++];
}
/*
* 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.
*/
if (!argfl && noflist)
return (rep);
! /* Initialize */
- 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;
if (lflg)
--- 1811,1836 ----
maxn = nfiles;
} else {
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 remaining initialization of this lbuf
! * as well as the stat(2) call.
*/
if (!argfl && noflist)
return (rep);
! /* Initialize non-zero members */
rep->lat.tv_sec = time(NULL);
rep->lct.tv_sec = time(NULL);
rep->lmt.tv_sec = time(NULL);
if (argfl || statreq) {
int doacl;
if (lflg)