From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1LRkiX-00067T-1t for qemu-devel@nongnu.org; Tue, 27 Jan 2009 04:58:49 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1LRkiT-00067F-AR for qemu-devel@nongnu.org; Tue, 27 Jan 2009 04:58:47 -0500 Received: from [199.232.76.173] (port=53049 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1LRkiT-00067C-4E for qemu-devel@nongnu.org; Tue, 27 Jan 2009 04:58:45 -0500 Received: from cantor2.suse.de ([195.135.220.15]:46411 helo=mx2.suse.de) by monty-python.gnu.org with esmtps (TLS-1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1LRkiS-0001r3-NZ for qemu-devel@nongnu.org; Tue, 27 Jan 2009 04:58:44 -0500 Message-ID: <497EDC53.1050608@suse.de> Date: Tue, 27 Jan 2009 11:05:07 +0100 From: Kevin Wolf MIME-Version: 1.0 Subject: Re: [Qemu-devel] [PATCH] Random MAC address option References: <200901270313.26331.pavel@pavlinux.ru> In-Reply-To: <200901270313.26331.pavel@pavlinux.ru> Content-Type: text/plain; charset=ISO-8859-15 Content-Transfer-Encoding: 7bit Reply-To: qemu-devel@nongnu.org List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: pavel@pavlinux.ru, qemu-devel@nongnu.org Pavel Vasilyev schrieb: > Index: Makefile.target > =================================================================== > --- Makefile.target (revision 6463) > +++ Makefile.target (working copy) > @@ -580,7 +580,8 @@ > OBJS+= fdc.o mc146818rtc.o serial.o i8259.o i8254.o pcspk.o pc.o > OBJS+= cirrus_vga.o apic.o parallel.o acpi.o piix_pci.o > OBJS+= usb-uhci.o vmmouse.o vmport.o vmware_vga.o hpet.o > -CPPFLAGS += -DHAS_AUDIO -DHAS_AUDIO_CHOICE > +CPPFLAGS += > +#-DHAS_AUDIO -DHAS_AUDIO_CHOICE > endif > ifeq ($(TARGET_BASE_ARCH), ppc) > CPPFLAGS += -DHAS_AUDIO -DHAS_AUDIO_CHOICE > Index: net.c > =================================================================== > --- net.c (revision 6463) > +++ net.c (working copy) > @@ -122,6 +122,24 @@ > > static VLANState *first_vlan; > > +unsigned long int random_mac_seed(void) { > + > + unsigned long int seed = 0; > + int fd; > + > + fd = open("/dev/urandom", O_RDONLY); How is that supposed to work on Windows? And what's wrong with rand()? > + if (fd == -1) { > + perror("open"); > + return 0; > + } > + if (read(fd, &seed, sizeof (seed)) < 0) { > + perror("read"); > + seed = 0; > + } > + if (close(fd)) > + perror("close"); > + return seed; > +} > /***********************************************************/ > /* network device redirectors */ > > @@ -160,7 +178,7 @@ > long int offset; > > errno = 0; > - offset = strtol(p, &last_char, 0); > + offset = strtol(p, &last_char, 0); > if (0 == errno && '\0' == *last_char && > offset >= 0 && offset <= 0xFFFFFF) { > macaddr[3] = (offset & 0xFF0000) >> 16; > @@ -179,7 +197,7 @@ > p++; > } > } > - return 0; > + return 0; > } > > return -1; I don't think these whitespace changes should be there. Kevin