NetworkManager r3442 - in trunk: . system-settings/plugins/ifcfg-fedora



Author: dcbw
Date: Wed Mar 12 22:40:25 2008
New Revision: 3442
URL: http://svn.gnome.org/viewvc/NetworkManager?rev=3442&view=rev

Log:
2008-03-12  Dan Williams  <dcbw redhat com>

	* system-settings/plugins/ifcfg-fedora/parser.c
	  system-settings/plugins/ifcfg-fedora/parser.h
		- (get_ifcfg_name): ignore more file suffixes
		- (is_wireless_device): fix check for ifcfgs that have no TYPE



Modified:
   trunk/ChangeLog
   trunk/system-settings/plugins/ifcfg-fedora/parser.c
   trunk/system-settings/plugins/ifcfg-fedora/parser.h

Modified: trunk/system-settings/plugins/ifcfg-fedora/parser.c
==============================================================================
--- trunk/system-settings/plugins/ifcfg-fedora/parser.c	(original)
+++ trunk/system-settings/plugins/ifcfg-fedora/parser.c	Wed Mar 12 22:40:25 2008
@@ -128,6 +128,21 @@
 	return TRUE;
 }
 
+static gboolean
+should_ignore_file (const char *basename, const char *tag)
+{
+	int len, tag_len;
+
+	g_return_val_if_fail (basename != NULL, TRUE);
+	g_return_val_if_fail (tag != NULL, TRUE);
+
+	len = strlen (basename);
+	tag_len = strlen (tag);
+	if ((len > tag_len) && !strcasecmp (basename + len - tag_len, tag))
+		return TRUE;
+	return FALSE;
+}
+
 static char *
 get_ifcfg_name (const char *file)
 {
@@ -145,8 +160,14 @@
 	if (strncmp (basename, IFCFG_TAG, strlen (IFCFG_TAG)))
 		goto error;
 
-	/* ignore .bak files */
-	if ((len > 4) && !strcasecmp (basename + len - 4, BAK_TAG))
+	/* ignore some files */
+	if (should_ignore_file (basename, BAK_TAG))
+		goto error;
+	if (should_ignore_file (basename, TILDE_TAG))
+		goto error;
+	if (should_ignore_file (basename, ORIG_TAG))
+		goto error;
+	if (should_ignore_file (basename, REJ_TAG))
 		goto error;
 
 	return g_strdup (basename + strlen (IFCFG_TAG));
@@ -800,7 +821,7 @@
 	wrq.u.data.length = sizeof (struct iw_range);
 
 	if (ioctl (fd, SIOCGIWRANGE, &wrq) < 0) {
-		if (errno == -EOPNOTSUPP)
+		if (errno == EOPNOTSUPP)
 			success = TRUE;
 		goto out;
 	}

Modified: trunk/system-settings/plugins/ifcfg-fedora/parser.h
==============================================================================
--- trunk/system-settings/plugins/ifcfg-fedora/parser.h	(original)
+++ trunk/system-settings/plugins/ifcfg-fedora/parser.h	Wed Mar 12 22:40:25 2008
@@ -29,6 +29,9 @@
 #define IFCFG_TAG "ifcfg-"
 #define KEYS_TAG "keys-"
 #define BAK_TAG ".bak"
+#define TILDE_TAG "~"
+#define ORIG_TAG ".orig"
+#define REJ_TAG ".rej"
 
 typedef struct {
 	char *ifcfg_path;



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]