]> git.alsa-project.org Git - alsa-utils.git/commitdiff
alsactl: fix some compiler warnings
authorJaroslav Kysela <perex@perex.cz>
Fri, 5 Mar 2021 20:43:45 +0000 (21:43 +0100)
committerJaroslav Kysela <perex@perex.cz>
Fri, 5 Mar 2021 20:43:47 +0000 (21:43 +0100)
BugLink: https://github.com/alsa-project/alsa-utils/issues/17
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
alsactl/alsactl.c
alsactl/utils.c

index 06ea7073061c8802237470981674c72ea1b18632..a3a6bfad49254e3b4f381ace54c1643d4bc76b2c 100644 (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];
index a83aa0ab14e9d6e567557874b6e97dc7e6f67803..f67421def07ad1650841b6485ca8a0645e1b9a66 100644 (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);
 }