From ade71cf8b09c892908c6a0d1bd087cee8d3fb8be Mon Sep 17 00:00:00 2001 From: Jaroslav Kysela Date: Fri, 5 Mar 2021 21:43:45 +0100 Subject: [PATCH] alsactl: fix some compiler warnings BugLink: https://github.com/alsa-project/alsa-utils/issues/17 Signed-off-by: Jaroslav Kysela --- alsactl/alsactl.c | 5 ++++- alsactl/utils.c | 12 ++++++------ 2 files changed, 10 insertions(+), 7 deletions(-) diff --git a/alsactl/alsactl.c b/alsactl/alsactl.c index 06ea707..a3a6bfa 100644 --- a/alsactl/alsactl.c +++ b/alsactl/alsactl.c @@ -356,7 +356,10 @@ int main(int argc, char *argv[]) /* when running in background, use syslog for reports */ if (background) { use_syslog = 1; - daemon(0, 0); + if (daemon(0, 0)) { + syslog(LOG_INFO, "alsactl " SND_UTIL_VERSION_STR " daemon cannot be started: %s", strerror(errno)); + goto out; + } } cmd = argv[optind]; diff --git a/alsactl/utils.c b/alsactl/utils.c index a83aa0a..f67421d 100644 --- a/alsactl/utils.c +++ b/alsactl/utils.c @@ -92,12 +92,12 @@ void initfailed(int cardnumber, const char *reason, int exitcode) return; sprintf(sexitcode, "%i", exitcode); fp = open(statefile, O_WRONLY|O_CREAT|O_APPEND, 0644); - write(fp, str, strlen(str)); - write(fp, ":", 1); - write(fp, reason, strlen(reason)); - write(fp, ":", 1); - write(fp, sexitcode, strlen(sexitcode)); - write(fp, "\n", 1); + (void)write(fp, str, strlen(str)); + (void)write(fp, ":", 1); + (void)write(fp, reason, strlen(reason)); + (void)write(fp, ":", 1); + (void)write(fp, sexitcode, strlen(sexitcode)); + (void)write(fp, "\n", 1); close(fp); free(str); }