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



git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@3442 4912f4e0-d625-0410-9fb7-b9a5a253dbdc
This commit is contained in:
Dan Williams 2008-03-12 22:40:25 +00:00
parent d0e629a8bb
commit d5efb7be6d
3 changed files with 34 additions and 3 deletions

View file

@ -1,3 +1,10 @@
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
2008-03-12 Dan Williams <dcbw@redhat.com>
* configure.in

View file

@ -128,6 +128,21 @@ get_int (const char *str, int *value)
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 @@ get_ifcfg_name (const char *file)
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 @@ is_wireless_device (const char *iface, gboolean *is_wireless)
wrq.u.data.length = sizeof (struct iw_range);
if (ioctl (fd, SIOCGIWRANGE, &wrq) < 0) {
if (errno == -EOPNOTSUPP)
if (errno == EOPNOTSUPP)
success = TRUE;
goto out;
}

View file

@ -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;