diff options
author | Colin Walters <walters@verbum.org> | 2017-02-24 09:33:20 -0500 |
---|---|---|
committer | Atomic Bot <atomic-devel@projectatomic.io> | 2017-02-24 17:08:27 +0000 |
commit | 877a27da0fecc0b9e4ff3f79ae50efa32bbffd16 (patch) | |
tree | 457267d53b96e6eb586d056beccbc0d30ce1b3b9 /src/ostree/ostree-trivial-httpd.c | |
parent | a71d550860e68be2b177d9016fe0227f1a547269 (diff) | |
download | ostree-877a27da0fecc0b9e4ff3f79ae50efa32bbffd16.tar.gz |
tree-wide: Squash noncritical compiler warnings
Should fix everything from
<https://kojipkgs.fedoraproject.org//packages/ostree/2017.2/3.fc25/data/logs/x86_64/build.log>
Anything that uses autocleanups should *always* be initialized directly I think,
even if a few lines down we directly assign, since this way it's more robust
against refactoring.
And the `freopen()` warnings are right - IMO we should *always* check return
values.
Closes: #711
Approved by: jlebon
Diffstat (limited to 'src/ostree/ostree-trivial-httpd.c')
-rw-r--r-- | src/ostree/ostree-trivial-httpd.c | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/src/ostree/ostree-trivial-httpd.c b/src/ostree/ostree-trivial-httpd.c index 72de8d79..d6f0c4d4 100644 --- a/src/ostree/ostree-trivial-httpd.c +++ b/src/ostree/ostree-trivial-httpd.c @@ -520,7 +520,7 @@ run (int argc, char **argv, GCancellable *cancellable, GError **error) } else { - g_autoptr(GFile) log_file; + g_autoptr(GFile) log_file = NULL; GFileOutputStream* log_stream; log_file = g_file_new_for_path (opt_log); @@ -601,9 +601,12 @@ run (int argc, char **argv, GCancellable *cancellable, GError **error) if (setsid () < 0) err (1, "setsid"); /* Daemonising: close stdout/stderr so $() et al work on us */ - freopen("/dev/null", "r", stdin); - freopen("/dev/null", "w", stdout); - freopen("/dev/null", "w", stderr); + if (freopen("/dev/null", "r", stdin) == NULL) + err (1, "freopen"); + if (freopen("/dev/null", "w", stdout) == NULL) + err (1, "freopen"); + if (freopen("/dev/null", "w", stderr) == NULL) + err (1, "freopen"); } else { |