ifcfg-rh: don't shadow basename

This commit is contained in:
Dan Williams 2009-04-21 18:12:41 -04:00
parent b96c60dae0
commit 641af69086
4 changed files with 25 additions and 25 deletions

View file

@ -198,16 +198,16 @@ read_one_connection (SCPluginIfcfg *plugin, const char *filename)
}
static gboolean
check_suffix (const char *basename, const char *tag)
check_suffix (const char *base, const char *tag)
{
int len, tag_len;
g_return_val_if_fail (basename != NULL, TRUE);
g_return_val_if_fail (base != NULL, TRUE);
g_return_val_if_fail (tag != NULL, TRUE);
len = strlen (basename);
len = strlen (base);
tag_len = strlen (tag);
if ((len > tag_len) && !strcasecmp (basename + len - tag_len, tag))
if ((len > tag_len) && !strcasecmp (base + len - tag_len, tag))
return TRUE;
return FALSE;
}
@ -215,22 +215,22 @@ check_suffix (const char *basename, const char *tag)
static gboolean
should_ignore_file (const char *filename)
{
char *basename;
char *base;
gboolean ignore = TRUE;
g_return_val_if_fail (filename != NULL, TRUE);
basename = g_path_get_basename (filename);
g_return_val_if_fail (basename != NULL, TRUE);
base = g_path_get_basename (filename);
g_return_val_if_fail (base != NULL, TRUE);
if ( !strncmp (basename, IFCFG_TAG, strlen (IFCFG_TAG))
&& !check_suffix (basename, BAK_TAG)
&& !check_suffix (basename, TILDE_TAG)
&& !check_suffix (basename, ORIG_TAG)
&& !check_suffix (basename, REJ_TAG))
if ( !strncmp (base, IFCFG_TAG, strlen (IFCFG_TAG))
&& !check_suffix (base, BAK_TAG)
&& !check_suffix (base, TILDE_TAG)
&& !check_suffix (base, ORIG_TAG)
&& !check_suffix (base, REJ_TAG))
ignore = FALSE;
g_free (basename);
g_free (base);
return ignore;
}

View file

@ -931,7 +931,7 @@ eap_simple_reader (const char *eap_method,
static char *
get_cert_file (const char *ifcfg_path, const char *cert_path)
{
const char *basename = cert_path;
const char *base = cert_path;
char *p, *ret, *dirname;
g_return_val_if_fail (ifcfg_path != NULL, NULL);
@ -942,10 +942,10 @@ get_cert_file (const char *ifcfg_path, const char *cert_path)
p = strrchr (cert_path, '/');
if (p)
basename = p + 1;
base = p + 1;
dirname = g_path_get_dirname (ifcfg_path);
ret = g_build_path ("/", dirname, basename, NULL);
ret = g_build_path ("/", dirname, base, NULL);
g_free (dirname);
return ret;
}

View file

@ -5184,7 +5184,7 @@ int main (int argc, char **argv)
{
GError *error = NULL;
DBusGConnection *bus;
char *basename;
char *base;
g_type_init ();
bus = dbus_g_bus_get (DBUS_BUS_SESSION, NULL);
@ -5239,9 +5239,9 @@ int main (int argc, char **argv)
test_write_mobile_broadband (TRUE);
test_write_mobile_broadband (FALSE);
basename = g_path_get_basename (argv[0]);
fprintf (stdout, "%s: SUCCESS\n", basename);
g_free (basename);
base = g_path_get_basename (argv[0]);
fprintf (stdout, "%s: SUCCESS\n", base);
g_free (base);
return 0;
}

View file

@ -144,14 +144,14 @@ char *
utils_get_ifcfg_name (const char *file)
{
char *ifcfg_name;
char *basename;
char *base;
basename = g_path_get_basename (file);
if (!basename)
base = g_path_get_basename (file);
if (!base)
return NULL;
ifcfg_name = g_strdup (basename + strlen (IFCFG_TAG));
g_free (basename);
ifcfg_name = g_strdup (base + strlen (IFCFG_TAG));
g_free (base);
return ifcfg_name;
}