From 2270b3c3c2831231d35e4debb1df50f72e03c9e8 Mon Sep 17 00:00:00 2001 From: "Ryan C. Gordon" Date: Mon, 14 Aug 2017 21:59:56 -0400 Subject: [PATCH] physfshttpd: removed deprecated PHYSFS_getLastError() calls. --- extras/physfshttpd.c | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/extras/physfshttpd.c b/extras/physfshttpd.c index 4a98baaa..6ae8fbed 100644 --- a/extras/physfshttpd.c +++ b/extras/physfshttpd.c @@ -78,6 +78,11 @@ static char *txt200 = "Content-Type: text/plain; charset=utf-8\n" "\n"; +static const char *lastError(void) +{ + return PHYSFS_getErrorByCode(PHYSFS_getLastErrorCode()); +} /* lastError */ + static int writeAll(const int fd, const void *buf, const size_t len) { return (write(fd, buf, len) == len); @@ -91,7 +96,7 @@ static void feed_file_http(const char *ipstr, int sock, const char *fname) if (in == NULL) { printf("%s: Can't open [%s]: %s.\n", - ipstr, fname, PHYSFS_getLastError()); + ipstr, fname, lastError()); if (!writeAll(sock, txt404, strlen(txt404))) printf("%s: Write error to socket.\n", ipstr); return; @@ -105,7 +110,7 @@ static void feed_file_http(const char *ipstr, int sock, const char *fname) PHYSFS_sint64 br = PHYSFS_readBytes(in, buffer, sizeof (buffer)); if (br == -1) { - printf("%s: Read error: %s.\n", ipstr, PHYSFS_getLastError()); + printf("%s: Read error: %s.\n", ipstr, lastError()); break; } /* if */ @@ -237,7 +242,7 @@ void at_exit_cleanup(void) close(listensocket); if (!PHYSFS_deinit()) - printf("PHYSFS_deinit() failed: %s\n", PHYSFS_getLastError()); + printf("PHYSFS_deinit() failed: %s\n", lastError()); } /* at_exit_cleanup */ @@ -267,7 +272,7 @@ int main(int argc, char **argv) if (!PHYSFS_init(argv[0])) { - printf("PHYSFS_init() failed: %s\n", PHYSFS_getLastError()); + printf("PHYSFS_init() failed: %s\n", lastError()); return 42; } /* if */