tls: fix compilation warning 657/head
authorVictor Seva <linuxmaniac@torreviejawireless.org>
Mon, 6 Jun 2016 09:47:23 +0000 (11:47 +0200)
committerVictor Seva <linuxmaniac@torreviejawireless.org>
Mon, 6 Jun 2016 10:05:39 +0000 (12:05 +0200)
> tls_config.c:403:6: warning: ignoring return value of function declared with warn_unused_result attribute [-Wunused-result]
>                                         write(out_fd, &ch, 1);
>                                         ^~~~~ ~~~~~~~~~~~~~~
> tls_config.c:408:5: warning: ignoring return value of function declared with warn_unused_result attribute [-Wunused-result]
>                                 write(out_fd, &ch, 1);
>                                 ^~~~~ ~~~~~~~~~~~~~~
> 2 warnings generated.

modules/tls/tls_config.c

index af1d88a..fc63155 100644 (file)
@@ -400,12 +400,16 @@ tls_domains_cfg_t* tls_load_config(str* filename)
                                pkg_free(file_path);
                                file_path = NULL;
                                while (read(in_fd, &ch, 1)) {
-                                       write(out_fd, &ch, 1);
+                                       if (write(out_fd, &ch, 1)<0) {
+                                               LOG(L_ERR, "write error: %s\n", strerror(errno));
+                                       }
                                }
                                close(in_fd);
                                in_fd = 0;
                                ch = '\n';
-                               write(out_fd, &ch, 1);
+                               if (write(out_fd, &ch, 1)<0) {
+                                       LOG(L_ERR, "write error: %s\n", strerror(errno));
+                               }
                        }
                }
                closedir(dir);