commit 7b702ee5b1454f9fb64e84e8a8bd4e670132b2af
parent ae69e325d305e6d6eb99eb959bd4902de8a8eeea
Author: Jacob R. Edwards <n/a>
Date: Mon, 10 Oct 2022 15:35:44 -0700
Fix "inert" bugs and remove unused variables
These bugs were unable to be reached with the current program but,
in the case of xargs, easily could have been in the future.
(Used clang compiler warnings to find all these issues.)
Diffstat:
4 files changed, 3 insertions(+), 4 deletions(-)
diff --git a/apc/apc.c b/apc/apc.c
@@ -111,7 +111,7 @@ xargs(struct apc *apc, FILE *fp)
nargs = 0;
buf = NULL;
size = 0;
- while ((len = getline(&buf, &size, stdin)) >= 0) {
+ while ((len = getline(&buf, &size, fp)) >= 0) {
if (len && buf[len - 1] == '\n')
buf[--len] = 0;
if (apc_bufword(apc, buf))
diff --git a/aps/command.c b/aps/command.c
@@ -278,7 +278,7 @@ com_terminate(struct aps *aps, int fd, int argc, char **argv)
char *
com_commands(struct aps *aps, int fd, int argc, char **argv)
{
- int i;
+ unsigned int i;
for (i = 0; i < aps->ncoms; ++i)
if (aps_bufline(aps, fd, aps->coms[i].name))
diff --git a/aps/player.c b/aps/player.c
@@ -33,7 +33,6 @@ int
pstart(struct player *p)
{
char *prog;
- int i;
if (p->state & (RUNNING | SUSPENDED)) {
errno = EALREADY;
diff --git a/lib/ap/client.c b/lib/ap/client.c
@@ -94,7 +94,7 @@ char *
apc_read(struct apc *apc)
{
size_t offset, len;
- char *buf, *end, *tmp;
+ char *buf, *end;
if (apc->status) {
free(apc->status);