[libvirt] [PATCH] util: Add win32 version of virFileUnlink

Commit 35847860f65f Added the virFileUnlink function, but failed to add a version for mingw build, causing the following error: Cannot export virFileUnlink: symbol not defined Signed-off-by: Martin Kletzander <mkletzan@redhat.com> --- src/util/virfile.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/src/util/virfile.c b/src/util/virfile.c index 408d2d912f13..75819d9c8bd7 100644 --- a/src/util/virfile.c +++ b/src/util/virfile.c @@ -2637,6 +2637,20 @@ virDirCreate(const char *path ATTRIBUTE_UNUSED, return -ENOSYS; } + +int +virFileUnlink(const char *path, + uid_t uid ATTRIBUTE_UNUSED, + gid_t gid ATTRIBUTE_UNUSED) +{ + if (unlink(path) < 0) { + virReportSystemError(errno, _("Unable to unlink path '%s'"), + path); + return -1; + } + + return 0; +} #endif /* WIN32 */ /** -- 2.5.1

On Mon, Sep 07, 2015 at 10:25:24AM +0200, Martin Kletzander wrote:
Commit 35847860f65f Added the virFileUnlink function, but failed to add a version for mingw build, causing the following error:
Cannot export virFileUnlink: symbol not defined
Signed-off-by: Martin Kletzander <mkletzan@redhat.com> --- src/util/virfile.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+)
ACK, it's a build breaker fix for MinGW builds. Pavel

On 09/07/2015 04:25 AM, Martin Kletzander wrote:
Commit 35847860f65f Added the virFileUnlink function, but failed to add a version for mingw build, causing the following error:
Cannot export virFileUnlink: symbol not defined
Signed-off-by: Martin Kletzander <mkletzan@redhat.com> --- src/util/virfile.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+)
Ugh... Sorry about this one... Too bad there wasn't a way to have some sort of make check rule - it wasn't the first and won't be the last time <sigh> ;-) John
diff --git a/src/util/virfile.c b/src/util/virfile.c index 408d2d912f13..75819d9c8bd7 100644 --- a/src/util/virfile.c +++ b/src/util/virfile.c @@ -2637,6 +2637,20 @@ virDirCreate(const char *path ATTRIBUTE_UNUSED,
return -ENOSYS; } + +int +virFileUnlink(const char *path, + uid_t uid ATTRIBUTE_UNUSED, + gid_t gid ATTRIBUTE_UNUSED) +{ + if (unlink(path) < 0) { + virReportSystemError(errno, _("Unable to unlink path '%s'"), + path); + return -1; + } + + return 0; +} #endif /* WIN32 */
/**

On Tue, Sep 08, 2015 at 09:12:11AM -0400, John Ferlan wrote:
On 09/07/2015 04:25 AM, Martin Kletzander wrote:
Commit 35847860f65f Added the virFileUnlink function, but failed to add a version for mingw build, causing the following error:
Cannot export virFileUnlink: symbol not defined
Signed-off-by: Martin Kletzander <mkletzan@redhat.com> --- src/util/virfile.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+)
Ugh... Sorry about this one... Too bad there wasn't a way to have some sort of make check rule - it wasn't the first and won't be the last time <sigh> ;-)
That's not easy without having such build. I'm sure there are many of those as the matrix of #ifs and #ifndefs etc. grows exponentially. If we had some kind of check for that, it would take way too much time. And the mingw build is still broken because other things I'm trying to investigate, so don't worry about that ;)
John
diff --git a/src/util/virfile.c b/src/util/virfile.c index 408d2d912f13..75819d9c8bd7 100644 --- a/src/util/virfile.c +++ b/src/util/virfile.c @@ -2637,6 +2637,20 @@ virDirCreate(const char *path ATTRIBUTE_UNUSED,
return -ENOSYS; } + +int +virFileUnlink(const char *path, + uid_t uid ATTRIBUTE_UNUSED, + gid_t gid ATTRIBUTE_UNUSED) +{ + if (unlink(path) < 0) { + virReportSystemError(errno, _("Unable to unlink path '%s'"), + path); + return -1; + } + + return 0; +} #endif /* WIN32 */
/**
participants (3)
-
John Ferlan
-
Martin Kletzander
-
Pavel Hrdina