format = disk->format;
} else {
if (driver->allowDiskFormatProbing) {
- if ((format = virStorageFileProbeFormat(disk->src)) < 0)
+ if ((format = virStorageFileProbeFormat(disk->src, driver->user,
+ driver->group)) < 0)
goto cleanup;
} else {
virReportError(VIR_ERR_INTERNAL_ERROR,
meta->backingStore = NULL;
if (meta->backingStoreFormat == VIR_STORAGE_FILE_AUTO &&
meta->backingStoreIsFile) {
- if ((ret = virStorageFileProbeFormat(*backingStore)) < 0) {
+ if ((ret = virStorageFileProbeFormat(*backingStore, -1, -1)) < 0) {
/* If the backing file is currently unavailable, only log an error,
* but continue. Returning -1 here would disable the whole storage
* pool, making it unavailable for even maintenance. */
* Best option: Don't use this function
*/
int
-virStorageFileProbeFormat(const char *path)
+virStorageFileProbeFormat(const char *path, uid_t uid, gid_t gid)
{
int fd, ret;
- if ((fd = open(path, O_RDONLY)) < 0) {
+ if ((fd = virFileOpenAs(path, O_RDONLY, 0, uid, gid, 0)) < 0) {
virReportSystemError(errno, _("cannot open file '%s'"), path);
return -1;
}
# define DEV_BSIZE 512
# endif
-int virStorageFileProbeFormat(const char *path);
+int virStorageFileProbeFormat(const char *path, uid_t uid, gid_t gid);
int virStorageFileProbeFormatFromFD(const char *path,
int fd);