Just like virFileReadAll, but returns -errno instead
of reporting errors. Useful for ignoring some errors.
virFileOpenTty;
virFilePrintf;
virFileReadAll;
+virFileReadAllQuiet;
virFileReadHeaderFD;
virFileReadLimFD;
virFileRelLinkPointsTo;
return len;
}
+int
+virFileReadAllQuiet(const char *path, int maxlen, char **buf)
+{
+ int fd = open(path, O_RDONLY);
+ if (fd < 0)
+ return -errno;
+
+ int len = virFileReadLimFD(fd, maxlen, buf);
+ VIR_FORCE_CLOSE(fd);
+ if (len < 0)
+ return -errno;
+
+ return len;
+}
+
/* Truncate @path and write @str to it. If @mode is 0, ensure that
@path exists; otherwise, use @mode if @path must be created.
Return 0 for success, nonzero for failure.
ATTRIBUTE_RETURN_CHECK ATTRIBUTE_NONNULL(3);
int virFileReadAll(const char *path, int maxlen, char **buf)
ATTRIBUTE_RETURN_CHECK ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(3);
+int virFileReadAllQuiet(const char *path, int maxlen, char **buf)
+ ATTRIBUTE_RETURN_CHECK ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(3);
int virFileWriteStr(const char *path, const char *str, mode_t mode)
ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2) ATTRIBUTE_RETURN_CHECK;