summaryrefslogtreecommitdiff
path: root/usr/src/common
diff options
context:
space:
mode:
authorJerry Jelinek <jerry.jelinek@joyent.com>2019-05-15 11:31:59 +0000
committerJerry Jelinek <jerry.jelinek@joyent.com>2019-05-15 11:31:59 +0000
commit6bb4da7d9bf3229c392786cff96466c702f9f70b (patch)
tree7803450e91f6222635cb97a50cfcf8805abb97cb /usr/src/common
parentde4ec02893492da797c0710325405f96ca3cb868 (diff)
parenta1e3874e014aca455b61f88dadd7b0f0145893e8 (diff)
downloadillumos-joyent-6bb4da7d9bf3229c392786cff96466c702f9f70b.tar.gz
[illumos-gate merge]
commit a1e3874e014aca455b61f88dadd7b0f0145893e8 10951 10895 unfixed 10146 commit 18d216a40f7635825d65521fbec434de192b5014 10933 loader: Make lsdev -v output line up in neat columns commit 7efc4ab5dcfd200d52afe798e576fd15b3ffad2d 10934 loader: improve some debugging experience commit fe20e172e8a2aff4961cf65d6975729eb3582b82 10927 loader: ficlPciBiosReadConfig() error: uninitialized symbol 'value'. commit 868fcfe93b967e5d10b7c95ef2d015c8900d607d 10833 sppptun: cast between incompatible function types commit d9c27481e4cab76c5b1c7abf01b386f487b83573 10831 loader emulator ls command fails to detect file types commit 7edfb5b07f43089085e704c276e1a7a0cb1cd32b 10653 ws: NULL pointer errors commit 391003522adc721450b82df5bf97cf692b1a683d 10763 hook: NULL pointer errors commit 626869622a4eee3f87a6a261787ec8a4d4798724 10649 sysmsg: NULL pointer errors commit 414e964c4d9092ad47a8db437b75edbed8f11ae0 10629 ptm: NULL pointer errors commit 25a5294972c1d74b8257cf0ec6d7a93f2da6a8ca 10615 nsmb: NULL pointer errors commit 1e655ac4fe8285c7994c0e6bd9f7ce23579b85b8 10956 sys-suspend(1M) integration with the x window system needs work
Diffstat (limited to 'usr/src/common')
-rw-r--r--usr/src/common/ficl/emu/loader_emu.c21
1 files changed, 10 insertions, 11 deletions
diff --git a/usr/src/common/ficl/emu/loader_emu.c b/usr/src/common/ficl/emu/loader_emu.c
index dcb2933b84..c3ebb3f21f 100644
--- a/usr/src/common/ficl/emu/loader_emu.c
+++ b/usr/src/common/ficl/emu/loader_emu.c
@@ -1552,20 +1552,19 @@ command_ls(int argc, char *argv[])
while ((d = readdir(dir)) != NULL) {
if (strcmp(d->d_name, ".") && strcmp(d->d_name, "..")) {
/* stat the file, if possible */
- sb.st_size = 0;
- sb.st_mode = 0;
- buf = malloc(strlen(path) + strlen(d->d_name) + 2);
if (path[0] == '\0') {
- (void) snprintf(buf, sizeof (buf), "%s",
- d->d_name);
+ (void) asprintf(&buf, "%s", d->d_name);
} else {
- (void) snprintf(buf, sizeof (buf), "%s/%s",
- path, d->d_name);
+ (void) asprintf(&buf, "%s/%s", path, d->d_name);
+ }
+ if (buf != NULL) {
+ /* ignore return, could be symlink, etc. */
+ if (stat(buf, &sb)) {
+ sb.st_size = 0;
+ sb.st_mode = 0;
+ }
+ free(buf);
}
- /* ignore return, could be symlink, etc. */
- if (stat(buf, &sb))
- sb.st_size = 0;
- free(buf);
if (verbose) {
(void) snprintf(lbuf, sizeof (lbuf),
" %c %8d %s\n",