public inbox for lvm2-cvs@sourceware.org
help / color / mirror / Atom feed
From: prajnoha@sourceware.org
To: lvm-devel@redhat.com, lvm2-cvs@sourceware.org
Subject: LVM2 ./WHATS_NEW_DM libdm/libdm-common.c
Date: Thu, 27 May 2010 15:02:00 -0000	[thread overview]
Message-ID: <20100527150258.3489.qmail@sourceware.org> (raw)

CVSROOT:	/cvs/lvm2
Module name:	LVM2
Changes by:	prajnoha@sourceware.org	2010-05-27 15:02:57

Modified files:
	.              : WHATS_NEW_DM 
	libdm          : libdm-common.c 

Log message:
	Use expected union semun for arguments in selected semaphore operations.
	
	This is standard and expected use. It also prevents errors related with
	misalignment of the arguments for semaphore operations on some architectures.

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/WHATS_NEW_DM.diff?cvsroot=lvm2&r1=1.373&r2=1.374
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/libdm/libdm-common.c.diff?cvsroot=lvm2&r1=1.95&r2=1.96

--- LVM2/WHATS_NEW_DM	2010/05/20 23:21:53	1.373
+++ LVM2/WHATS_NEW_DM	2010/05/27 15:02:56	1.374
@@ -1,5 +1,6 @@
 Version 1.02.49 - 
 ================================
+  Use expected union semun for arguments in selected semaphore operations.
 
 Version 1.02.48 - 17th May 2010
 ================================
--- LVM2/libdm/libdm-common.c	2010/05/03 21:06:53	1.95
+++ LVM2/libdm/libdm-common.c	2010/05/27 15:02:56	1.96
@@ -43,6 +43,18 @@
 
 #define DEV_DIR "/dev/"
 
+#ifdef UDEV_SYNC_SUPPORT
+#ifdef _SEM_SEMUN_UNDEFINED
+union semun
+{
+	int val;			/* value for SETVAL */
+	struct semid_ds *buf;		/* buffer for IPC_STAT & IPC_SET */
+	unsigned short int *array;	/* array for GETALL & SETALL */
+	struct seminfo *__buf;		/* buffer for IPC_INFO */
+};
+#endif
+#endif
+
 static char _dm_dir[PATH_MAX] = DEV_DIR DM_DIR;
 
 static int _verbose = 0;
@@ -1076,6 +1088,7 @@
 	int gen_semid;
 	uint16_t base_cookie;
 	uint32_t gen_cookie;
+	union semun sem_arg;
 
 	if ((fd = open("/dev/urandom", O_RDONLY)) < 0) {
 		log_error("Failed to open /dev/urandom "
@@ -1123,7 +1136,9 @@
 	log_debug("Udev cookie 0x%" PRIx32 " (semid %d) created",
 		  gen_cookie, gen_semid);
 
-	if (semctl(gen_semid, 0, SETVAL, 1) < 0) {
+	sem_arg.val = 1;
+
+	if (semctl(gen_semid, 0, SETVAL, sem_arg) < 0) {
 		log_error("semid %d: semctl failed: %s", gen_semid, strerror(errno));
 		/* We have to destroy just created semaphore
 		 * so it won't stay in the system. */


             reply	other threads:[~2010-05-27 15:02 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-05-27 15:02 prajnoha [this message]
  -- strict thread matches above, loose matches on Subject: below --
2012-03-05 12:45 prajnoha
2012-02-28  8:36 prajnoha
2012-02-13 10:49 zkabelac
2012-02-08 11:07 zkabelac
2011-03-30 12:14 zkabelac
2010-08-03  7:56 prajnoha
2009-09-25 18:08 agk

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20100527150258.3489.qmail@sourceware.org \
    --to=prajnoha@sourceware.org \
    --cc=lvm-devel@redhat.com \
    --cc=lvm2-cvs@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).