1
0
forked from aniani/gmnisrv

serve: handle return value from chdir

Fixes a compile error on gcc 9.3.0:

src/serve.c: In function 'serve_cgi':
src/serve.c:150:3: error: ignoring return value of 'chdir', declared
with attribute warn_unused_result [-Werror=unused-result]
  150 |   chdir(dirname(cwd));
      |   ^~~~~~~~~~~~~~~~~~~

Signed-off-by: William Casarin <jb55@jb55.com>
This commit is contained in:
William Casarin 2020-11-20 08:17:13 -08:00 committed by Drew DeVault
parent c538c2aae9
commit 10662cac46

View File

@ -147,7 +147,8 @@ serve_cgi(struct gmnisrv_client *client, const char *path,
char cwd[PATH_MAX + 1]; char cwd[PATH_MAX + 1];
strcpy(cwd, path); strcpy(cwd, path);
chdir(dirname(cwd)); int chdir_res = chdir(dirname(cwd));
assert(chdir_res != -1);
// I don't feel like freeing this stuff and this process is // I don't feel like freeing this stuff and this process is
// going to die soon anyway so let's just be hip and call it an // going to die soon anyway so let's just be hip and call it an