TODO: DO NOT use a hardcoded path
| 131 | |
| 132 | // TODO: DO NOT use a hardcoded path |
| 133 | Status GetTmpFilename(string* filename) { |
| 134 | #ifndef _WIN32 |
| 135 | char buffer[] = "/tmp/gcs_filesystem_XXXXXX"; |
| 136 | int fd = mkstemp(buffer); |
| 137 | if (fd < 0) { |
| 138 | return errors::Internal("Failed to create a temporary file."); |
| 139 | } |
| 140 | close(fd); |
| 141 | #else |
| 142 | char buffer[] = "/tmp/gcs_filesystem_XXXXXX"; |
| 143 | char* ret = _mktemp(buffer); |
| 144 | if (ret == nullptr) { |
| 145 | return errors::Internal("Failed to create a temporary file."); |
| 146 | } |
| 147 | #endif |
| 148 | *filename = buffer; |
| 149 | return Status::OK(); |
| 150 | } |
| 151 | |
| 152 | /// \brief Splits a GCS path to a bucket and an object. |
| 153 | /// |
no test coverage detected