FAQ Search Today's Posts Mark Forums Read
» Video Reviews

» Linux Archive

Linux-archive is a website aiming to archive linux email lists and to make them easily accessible for linux users/developers.


» Sponsor

» Partners

» Sponsor

Go Back   Linux Archive > Redhat > Device-mapper Development

 
 
LinkBack Thread Tools
 
Old 05-12-2008, 05:46 PM
 
Default multipath-tools/multipath main.c

CVSROOT: /cvs/dm
Module name: multipath-tools
Branch: RHEL5_FC6
Changes by: bmarzins@sourceware.org 2008-05-12 17:46:41

Modified files:
multipath : main.c

Log message:
fix config freeing.

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/multipath-tools/multipath/main.c.diff?cvsroot=dm&only_with_tag=RHEL5_FC6&r1= 1.44.2.4&r2=1.44.2.5

--- multipath-tools/multipath/main.c 2007/11/10 00:01:59 1.44.2.4
+++ multipath-tools/multipath/main.c 2008/05/12 17:46:41 1.44.2.5
@@ -1,7 +1,7 @@
/*
* Soft: multipath device mapper target autoconfig
*
- * Version: $Id: main.c,v 1.44.2.4 2007/11/10 00:01:59 bmarzins Exp $
+ * Version: $Id: main.c,v 1.44.2.5 2008/05/12 17:46:41 bmarzins Exp $
*
* Author: Christophe Varoqui
*
@@ -414,9 +414,17 @@
condlog(3, "restart multipath configuration process");

out:
- free_config(conf);
dm_lib_release();
dm_lib_exit();
+
+ /*
+ * Freeing config must be done after dm_lib_exit(), because
+ * the logging function (dm_write_log()), which is called there,
+ * references the config.
+ */
+ free_config(conf);
+ conf = NULL;
+
#ifdef _DEBUG_
dbg_free_final(NULL);
#endif

--
dm-devel mailing list
dm-devel@redhat.com
https://www.redhat.com/mailman/listinfo/dm-devel
 
Old 10-24-2011, 01:44 PM
 
Default multipath-tools/multipath main.c

CVSROOT: /cvs/dm
Module name: multipath-tools
Branch: RHEL5_FC6
Changes by: bmarzins@sourceware.org 2011-10-24 13:44:25

Modified files:
multipath : main.c

Log message:
Fix for bz #740022. Do better type checking on the argument passed to multipath,
to determine whether it's a path device name, dev_t, or a multipath device.

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/multipath-tools/multipath/main.c.diff?cvsroot=dm&only_with_tag=RHEL5_FC6&r1= 1.44.2.10&r2=1.44.2.11

--- multipath-tools/multipath/main.c 2010/04/24 05:28:06 1.44.2.10
+++ multipath-tools/multipath/main.c 2011/10/24 13:44:25 1.44.2.11
@@ -1,7 +1,7 @@
/*
* Soft: multipath device mapper target autoconfig
*
- * Version: $Id: main.c,v 1.44.2.10 2010/04/24 05:28:06 bmarzins Exp $
+ * Version: $Id: main.c,v 1.44.2.11 2011/10/24 13:44:25 bmarzins Exp $
*
* Author: Christophe Varoqui
*
@@ -21,7 +21,8 @@
* Copyright (c) 2005 Patrick Caulfield, Redhat
* Copyright (c) 2005 Edward Goggin, EMC
*/
-
+#include <sys/types.h>
+#include <sys/stat.h>
#include <stdio.h>
#include <unistd.h>
#include <ctype.h>
@@ -47,6 +48,7 @@
#include <configure.h>
#include <pgpolicies.h>
#include <version.h>
+#include "dev_t.h"

static int
filter_pathvec (vector pathvec, char * refwwid)
@@ -302,13 +304,29 @@
return r;
}

+static int
+get_dev_type(char *dev) {
+ struct stat buf;
+ int i;
+
+ if (stat(dev, &buf) == 0 && S_ISBLK(buf.st_mode)) {
+ if (dm_is_dm_major(MAJOR(buf.st_rdev)))
+ return DEV_DEVMAP;
+ return DEV_DEVNODE;
+ }
+ else if (sscanf(dev, "%d:%d", &i, &i) == 2)
+ return DEV_DEVT;
+ else
+ return DEV_DEVMAP;
+}
+
int
main (int argc, char *argv[])
{
int arg;
extern char *optarg;
extern int optind;
- int i, r = 1;
+ int r = 1;

if (getuid() != 0) {
fprintf(stderr, "need to be root
");
@@ -396,13 +414,7 @@

strncpy(conf->dev, argv[optind], FILE_NAME_SIZE);

- if (filepresent(conf->dev))
- conf->dev_type = DEV_DEVNODE;
- else if (sscanf(conf->dev, "%d:%d", &i, &i) == 2)
- conf->dev_type = DEV_DEVT;
- else
- conf->dev_type = DEV_DEVMAP;
-
+ conf->dev_type = get_dev_type(conf->dev);
}
dm_init();


--
dm-devel mailing list
dm-devel@redhat.com
https://www.redhat.com/mailman/listinfo/dm-devel
 

Thread Tools




All times are GMT. The time now is 04:10 PM.

VBulletin, Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.
Copyright 2007 - 2008, www.linux-archive.org