diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/opk.c | 15 |
1 files changed, 11 insertions, 4 deletions
@@ -235,8 +235,8 @@ opkg_opk_opk_list_members(struct opkg_opk_opk *opk) size_t gname_len_max; uint64_t size_max; long int size_len_max; - char fmt[29]; - /* "%c%s %-32s/%-32s %11d %s %s\n" */ + char fmt[28]; + /* "%c%s %-32s/%-32s %11d %s %s" */ size_t len; char mode[10]; char mtime[20]; @@ -287,9 +287,9 @@ opkg_opk_opk_list_members(struct opkg_opk_opk *opk) /* Print and free members. */ ret = OPKG_OPK_OK; size_len_max = lrint(ceil(log10(size_max))); - snprintf(fmt, sizeof(fmt), "%%c%%s %%-%zus/%%-%zus %%%lid %%s %%s\n", + snprintf(fmt, sizeof(fmt), "%%c%%s %%-%zus/%%-%zus %%%lid %%s %%s", uname_len_max, gname_len_max, size_len_max); - len = 35 + uname_len_max + gname_len_max + size_len_max; + len = 34 + uname_len_max + gname_len_max + size_len_max; for (member = head; member != NULL;) { if (member->mode & 00400) mode[0] = 'r'; else mode[0] = '-'; if (member->mode & 00200) mode[1] = 'w'; else mode[1] = '-'; @@ -315,6 +315,13 @@ opkg_opk_opk_list_members(struct opkg_opk_opk *opk) ret = OPKG_OPK_ERROR; } #pragma GCC diagnostic pop + if (member->type == 'l' && printf(" -> %s", member->linkname) != + (int) (strlen(member->linkname) + 4)) { + ret = OPKG_OPK_ERROR; + } + if (puts("") == EOF) { + ret = OPKG_OPK_ERROR; + } head = member; member = member->next; free(head); |