Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
physfshttpd: removed deprecated PHYSFS_getLastError() calls.
  • Loading branch information
icculus committed Aug 15, 2017
1 parent b311ee4 commit 2270b3c
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions extras/physfshttpd.c
Expand Up @@ -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);
Expand All @@ -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;
Expand All @@ -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 */

Expand Down Expand Up @@ -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 */


Expand Down Expand Up @@ -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 */

Expand Down

0 comments on commit 2270b3c

Please sign in to comment.