Mercurial > illumos > illumos-gate
changeset 13252:660c760d3375
409 ls doesn't like -xstrconst
Reviewed by: garrett@nexenta.com
Reviewed by: jason@ansipunx.net
Approved by: garrett@nexenta.com
author | Albert Lee <trisk@nexenta.com> |
---|---|
date | Mon, 06 Dec 2010 05:27:25 +0000 |
parents | f1dd13f1ef7d |
children | 84e1c76098c5 |
files | usr/src/cmd/ls/ls.c |
diffstat | 1 files changed, 14 insertions(+), 4 deletions(-) [+] |
line wrap: on
line diff
--- a/usr/src/cmd/ls/ls.c Sun Dec 05 19:54:51 2010 -0800 +++ b/usr/src/cmd/ls/ls.c Mon Dec 06 05:27:25 2010 +0000 @@ -649,8 +649,8 @@ timelen += 2 + 3; told = malloc(timelen); if (told == NULL) { - perror("Out of memory"); - exit(1); + perror("ls"); + exit(2); } (void) memset(told, 0, timelen); @@ -1919,6 +1919,11 @@ } buf[cc] = '\0'; rep->flinkto = strdup(buf); + if (rep->flinkto == NULL) { + perror("ls"); + nomocore = 1; + return (NULL); + } break; } @@ -3064,8 +3069,11 @@ if (termret != 1) return; - if ((colorstr = getenv("LS_COLORS")) == NULL) - colorstr = default_colorstr; + if ((p = getenv("LS_COLORS")) == NULL) + p = default_colorstr; + colorstr = strdup(p); + if (colorstr == NULL) + return; /* * Determine the size of lsc_colors. color_sz can be > lsc_ncolors @@ -3127,6 +3135,8 @@ for (i = 0; i < lsc_ncolors; ++i) dump_color(&lsc_colors[i]); } + + free(colorstr); } /* Free extended system attribute lists */