X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?a=blobdiff_plain;f=src%2Fcore%2Fhostname-setup.c;h=dbd2227e212d47464d190eba8a77c43d9de6f4cb;hb=774de5a97fe69da822fde77b88af8d970ab5d0c6;hp=e3ea5fe767f8a8440f0a895087622d153510ea2c;hpb=344de60901f0e3ce0d2f112b7be97fc6d0e2f071;p=elogind.git diff --git a/src/core/hostname-setup.c b/src/core/hostname-setup.c index e3ea5fe76..dbd2227e2 100644 --- a/src/core/hostname-setup.c +++ b/src/core/hostname-setup.c @@ -30,12 +30,10 @@ #include "util.h" #include "log.h" -#if defined(TARGET_FEDORA) || defined(TARGET_ALTLINUX) || defined(TARGET_MANDRIVA) || defined(TARGET_MEEGO) || defined(TARGET_MAGEIA) +#if defined(TARGET_ALTLINUX) || defined(TARGET_MANDRIVA) || defined(TARGET_MAGEIA) #define FILENAME "/etc/sysconfig/network" #elif defined(TARGET_SUSE) || defined(TARGET_SLACKWARE) #define FILENAME "/etc/HOSTNAME" -#elif defined(TARGET_ARCH) -#define FILENAME "/etc/rc.conf" #elif defined(TARGET_GENTOO) #define FILENAME "/etc/conf.d/hostname" #endif @@ -65,9 +63,9 @@ static int read_and_strip_hostname(const char *path, char **hn) { static int read_distro_hostname(char **hn) { -#if defined(TARGET_FEDORA) || defined(TARGET_ARCH) || defined(TARGET_GENTOO) || defined(TARGET_ALTLINUX) || defined(TARGET_MANDRIVA) || defined(TARGET_MEEGO) || defined(TARGET_MAGEIA) +#if defined(TARGET_GENTOO) || defined(TARGET_ALTLINUX) || defined(TARGET_MANDRIVA) || defined(TARGET_MAGEIA) int r; - FILE *f; + _cleanup_fclose_ FILE *f = NULL; assert(hn); @@ -114,7 +112,6 @@ static int read_distro_hostname(char **hn) { r = -ENOENT; finish: - fclose(f); return r; #elif defined(TARGET_SUSE) || defined(TARGET_SLACKWARE)