alsactl: fix some compiler warnings

BugLink: https://github.com/alsa-project/alsa-utils/issues/17
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
This commit is contained in:
Jaroslav Kysela 2021-03-05 21:43:45 +01:00
parent bccebc59a0
commit ade71cf8b0
2 changed files with 10 additions and 7 deletions

View file

@ -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];

View file

@ -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);
}