mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2025-12-31 23:00:11 +01:00
utils: add nm_utils_is_specific_hostname()
The function detects whether the hostname is a specific hostname diferrent from default hostnames like localhost, localhost[6].localdomain[6].
This commit is contained in:
parent
568742ed41
commit
70e930bc0e
2 changed files with 18 additions and 2 deletions
|
|
@ -15,7 +15,7 @@
|
|||
* with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Copyright (C) 2004 - 2012 Red Hat, Inc.
|
||||
* Copyright (C) 2004 - 2014 Red Hat, Inc.
|
||||
* Copyright (C) 2005 - 2008 Novell, Inc.
|
||||
*/
|
||||
|
||||
|
|
@ -1574,3 +1574,17 @@ fail:
|
|||
g_error ("FATAL: Failed asserting path component: %s", name ? name : "(null)");
|
||||
}
|
||||
|
||||
gboolean
|
||||
nm_utils_is_specific_hostname (const char *name)
|
||||
{
|
||||
if (!name)
|
||||
return FALSE;
|
||||
if ( strcmp (name, "(none)")
|
||||
&& strcmp (name, "localhost")
|
||||
&& strcmp (name, "localhost6")
|
||||
&& strcmp (name, "localhost.localdomain")
|
||||
&& strcmp (name, "localhost6.localdomain6"))
|
||||
return TRUE;
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -15,7 +15,7 @@
|
|||
* with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Copyright (C) 2004 - 2011 Red Hat, Inc.
|
||||
* Copyright (C) 2004 - 2014 Red Hat, Inc.
|
||||
* Copyright (C) 2005 - 2008 Novell, Inc.
|
||||
*/
|
||||
|
||||
|
|
@ -134,4 +134,6 @@ gint32 nm_utils_get_monotonic_timestamp_s (void);
|
|||
const char *ASSERT_VALID_PATH_COMPONENT (const char *name) G_GNUC_WARN_UNUSED_RESULT;
|
||||
const char *nm_utils_ip6_property_path (const char *ifname, const char *property);
|
||||
|
||||
gboolean nm_utils_is_specific_hostname (const char *name);
|
||||
|
||||
#endif /* NETWORK_MANAGER_UTILS_H */
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue