commit 7095779d2fa0d126b2eb2f36eeab0969d3b9feec
parent 55c15dff701c7bb10811537a6c6beda6b9ab8e7e
Author: Jacob R. Edwards <n/a>
Date: Sat, 17 Sep 2022 17:38:04 -0700
Fix test for named socket
It's less elegant than the previous method (had it actually worked),
but is functional.
Diffstat:
2 files changed, 4 insertions(+), 5 deletions(-)
diff --git a/aps/aps.c b/aps/aps.c
@@ -161,12 +161,11 @@ aps_handle(struct aps *aps, int fd)
}
int
-aps_isnamed(struct aps *aps)
+aps_named(struct aps *aps)
{
struct stat sb;
- assert(fstat(aps->con->sock, &sb) == 0, "fstat socket");
- return sb.st_nlink;
+ return !stat(aps->con->path, &sb);
}
int
@@ -186,7 +185,7 @@ aps_update(struct aps *aps)
}
}
- if (!aps_isnamed(aps) && !aps->nfds)
+ if (!aps_named(aps) && !aps->nfds)
aps->close = 1;
return 0;
diff --git a/aps/aps.h b/aps/aps.h
@@ -29,11 +29,11 @@ void aps_close(struct aps *);
int aps_drop(struct aps *, int);
int aps_accept(struct aps *);
int aps_handle(struct aps *, int);
+int aps_named(struct aps *);
int aps_update(struct aps *);
char *aps_read(struct aps *, int);
int aps_command(struct aps *, int);
void aps_errordrop(struct aps *, int, char *);
int aps_seek(struct aps *, struct item *(*)(struct item *), char *);
int aps_play(struct aps *, struct item *);
-int aps_isnamed(struct aps *);
int aps_unname(struct aps *);