]> git.sesse.net Git - cubemap/blobdiff - util.cpp
Identify UDPInput error messages by the stream, too.
[cubemap] / util.cpp
index 41c13c6f2a3ed743a5345b3d0d41c37aefb6e5bc..8159e3821ccb1071efa8801ae8a63b90b65d2db4 100644 (file)
--- 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.
        }