[libvirt] [PATCH 1/1] lxc: use our own hand-rolled code in place of unlockpt and grantpt (v2)
Daniel P. Berrange
berrange at redhat.com
Thu Oct 20 09:03:59 UTC 2011
On Wed, Oct 19, 2011 at 02:47:36PM -0600, Eric Blake wrote:
> Looks good (better would be using openpty(), once gnulib changes
> that to LGPLv2+, but I'll deal with that in a later patch). So,
> while waiting on gnulib changes, I'll temporarily #ifdef out this
> code so that I don't break mingw compilation.
Unfortuntely it broke anyway.
> ACK to the intent and to incorporating previous review comments.
> Here's what I squashed in before pushing:
> diff --git i/src/util/util.c w/src/util/util.c
> index 1ec36f1..b2cdf6a 100644
> --- i/src/util/util.c
> +++ w/src/util/util.c
> @@ -1106,6 +1106,12 @@ int virFileOpenTty(int *ttymaster,
> {
> int rc = -1;
>
> +#ifdef WIN32
> + /* mingw completely lacks pseudo-terminals. */
> + errno = ENOSYS;
> +
> +#else /* !WIN32 */
> +
> if ((*ttymaster = posix_openpt(O_RDWR|O_NOCTTY|O_NONBLOCK)) < 0)
> goto cleanup;
>
> @@ -1144,8 +1150,8 @@ cleanup:
> if (rc != 0)
> VIR_FORCE_CLOSE(*ttymaster);
>
> +#endif /* !WIN32 */
> return rc;
> -
> }
cc1: warnings being treated as errors
../../src/util/util.c: In function 'virFileOpenTty':
../../src/util/util.c:1103:25: error: unused parameter 'ttymaster' [-Wunused-parameter]
../../src/util/util.c:1104:27: error: unused parameter 'ttyName' [-Wunused-parameter]
../../src/util/util.c:1105:24: error: unused parameter 'rawmode' [-Wunused-parameter]
Here's what I'm pushing as a build breaker fix
diff --git a/src/util/util.c b/src/util/util.c
index 01146f5..af27344 100644
--- a/src/util/util.c
+++ b/src/util/util.c
@@ -1099,20 +1099,13 @@ virFileBuildPath(const char *dir, const char *name, const char *ext)
return path;
}
-
+#ifndef WIN32
int virFileOpenTty(int *ttymaster,
char **ttyName,
int rawmode)
{
int rc = -1;
-#ifdef WIN32
- /* mingw completely lacks pseudo-terminals, and the gnulib
- * replacements are not (yet) license compatible. */
- errno = ENOSYS;
-
-#else /* !WIN32 */
-
if ((*ttymaster = posix_openpt(O_RDWR|O_NOCTTY|O_NONBLOCK)) < 0)
goto cleanup;
@@ -1151,9 +1144,19 @@ cleanup:
if (rc != 0)
VIR_FORCE_CLOSE(*ttymaster);
-#endif /* !WIN32 */
return rc;
}
+#else /* WIN32 */
+int virFileOpenTty(int *ttymaster ATTRIBUTE_UNUSED,
+ char **ttyName ATTRIBUTE_UNUSED,
+ int rawmode ATTRIBUTE_UNUSED)
+{
+ /* mingw completely lacks pseudo-terminals, and the gnulib
+ * replacements are not (yet) license compatible. */
+ errno = ENOSYS;
+ return -1;
+}
+#endif /* WIN32 */
/*
* Creates an absolute path for a potentially relative path.
Daniel
--
|: http://berrange.com -o- http://www.flickr.com/photos/dberrange/ :|
|: http://libvirt.org -o- http://virt-manager.org :|
|: http://autobuild.org -o- http://search.cpan.org/~danberr/ :|
|: http://entangle-photo.org -o- http://live.gnome.org/gtk-vnc :|
More information about the libvir-list
mailing list