ls could mis-color certain entries when previous commands
had failed. Explicitly 0 out errno to prevent that.
This commit is contained in:
parent
272a95524f
commit
5f6873621d
@ -716,6 +716,7 @@ static int list_single(struct dnode *dn)
|
|||||||
#endif
|
#endif
|
||||||
case LIST_FILENAME:
|
case LIST_FILENAME:
|
||||||
#ifdef CONFIG_FEATURE_LS_COLOR
|
#ifdef CONFIG_FEATURE_LS_COLOR
|
||||||
|
errno = 0;
|
||||||
if (show_color && !lstat(dn->fullname, &info)) {
|
if (show_color && !lstat(dn->fullname, &info)) {
|
||||||
printf( "\033[%d;%dm", bgcolor(info.st_mode),
|
printf( "\033[%d;%dm", bgcolor(info.st_mode),
|
||||||
fgcolor(info.st_mode) );
|
fgcolor(info.st_mode) );
|
||||||
@ -741,6 +742,7 @@ static int list_single(struct dnode *dn)
|
|||||||
#endif
|
#endif
|
||||||
#ifdef CONFIG_FEATURE_LS_COLOR
|
#ifdef CONFIG_FEATURE_LS_COLOR
|
||||||
if (show_color) {
|
if (show_color) {
|
||||||
|
errno = 0;
|
||||||
printf( "\033[%d;%dm", bgcolor(info.st_mode),
|
printf( "\033[%d;%dm", bgcolor(info.st_mode),
|
||||||
fgcolor(info.st_mode) );
|
fgcolor(info.st_mode) );
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user