"Richard W.M. Jones" <rjones(a)redhat.com> wrote:
There is no uid_t or getuid in MinGW.
I'm not really sure that forcing connections readonly if the user is
non-root is a useful thing to be doing anyway, so perhaps this code is
better off just being deleted?
For the missing uid_t, you could add this to configure.in
AC_CHECK_TYPE(mode_t, int)
then no need for ifndef around the decl of "uid".
With this function (and a test for getuid in configure.in),
(or maybe that should be "return 0"?)
#ifndef HAVE_GETUID
static int getuid() { return 1; }
#endif /* __MINGW32__ */
you could avoid the remaining ifdefs.
--
Emerging Technologies, Red Hat -
http://et.redhat.com/~rjones/
Registered Address: Red Hat UK Ltd, Amberley Place, 107-111 Peascod
Rich.
Street, Windsor, Berkshire, SL4 1TE, United Kingdom. Registered in
England and Wales under Company Registration No. 03798903
Index: src/virsh.c
===================================================================
RCS file: /data/cvs/libvirt/src/virsh.c,v
retrieving revision 1.118
diff -u -r1.118 virsh.c
--- src/virsh.c 6 Dec 2007 16:36:21 -0000 1.118
+++ src/virsh.c 7 Dec 2007 10:44:05 -0000
@@ -202,7 +202,9 @@
virConnectPtr conn; /* connection to hypervisor (MAY BE NULL) */
vshCmd *cmd; /* the current command */
char *cmdstr; /* string with command */
+#ifndef __MINGW32__
uid_t uid; /* process owner */
+#endif /* __MINGW32__ */
int imode; /* interactive mode? */
int quiet; /* quiet mode */
int debug; /* print debug messages? */
@@ -4508,17 +4523,21 @@
if (ctl->conn)
return FALSE;
+#ifndef __MINGW32__
ctl->uid = getuid();
+#endif
vshOpenLogFile(ctl);
/* set up the library error handler */
virSetErrorFunc(NULL, virshErrorHandler);
+#ifndef __MINGW32__
/* Force a non-root, Xen connection to readonly */
if ((ctl->name == NULL ||
!strcasecmp(ctl->name, "xen")) && ctl->uid != 0)
ctl->readonly = 1;
+#endif