X-Git-Url: https://git.sesse.net/?p=cubemap;a=blobdiff_plain;f=util.cpp;h=8159e3821ccb1071efa8801ae8a63b90b65d2db4;hp=41c13c6f2a3ed743a5345b3d0d41c37aefb6e5bc;hb=0d72f384a1de672824298262ba5c427ec0aee2d6;hpb=3ce04a3c410c5836394417b19e70f2a95bc8a5e7 diff --git a/util.cpp b/util.cpp index 41c13c6..8159e38 100644 --- a/util.cpp +++ b/util.cpp @@ -14,12 +14,12 @@ int make_tempfile(const std::string &contents) char filename[] = "/tmp/cubemap.XXXXXX"; int fd = mkstemp(filename); if (fd == -1) { - perror("mkstemp"); + log_perror("mkstemp"); return -1; } if (unlink(filename) == -1) { - perror("unlink"); + log_perror("unlink"); // Can still continue; } @@ -28,7 +28,7 @@ int make_tempfile(const std::string &contents) while (to_write > 0) { ssize_t ret = write(fd, ptr, to_write); if (ret == -1) { - perror("write"); + log_perror("write"); close(fd); return -1; } @@ -47,7 +47,7 @@ bool read_tempfile(int fd, std::string *contents) off_t len = lseek(fd, 0, SEEK_END); if (len == -1) { - perror("lseek"); + log_perror("lseek"); ok = false; goto done; } @@ -55,7 +55,7 @@ bool read_tempfile(int fd, std::string *contents) contents->resize(len); if (lseek(fd, 0, SEEK_SET) == -1) { - perror("lseek"); + log_perror("lseek"); ok = false; goto done; } @@ -64,7 +64,7 @@ bool read_tempfile(int fd, std::string *contents) while (has_read < len) { ret = read(fd, &((*contents)[has_read]), len - has_read); if (ret == -1) { - perror("read"); + log_perror("read"); ok = false; goto done; } @@ -82,7 +82,7 @@ done: } while (ret == -1 && errno == EINTR); if (ret == -1) { - perror("close"); + log_perror("close"); // Can still continue. }