sulogin: don't use {de,con}structor attributes

We're not Russian roulette players, so don't use such ugly things at all..

Reported-by:  Dave Reisner <d@falconindy.com>
Signed-off-by: Karel Zak <kzak@redhat.com>
This commit is contained in:
Karel Zak 2012-12-23 22:44:05 +01:00
parent a73f59fa03
commit 4226f910d4
3 changed files with 17 additions and 2 deletions

View File

@ -98,7 +98,6 @@ static uint32_t emergency_flags;
# define MNT_PROCFS 0x0001
# define MNT_DEVTMPFS 0x0002
static __attribute__((__destructor__))
void emergency_do_umounts(void)
{
if (emergency_flags & MNT_DEVTMPFS)
@ -107,7 +106,6 @@ void emergency_do_umounts(void)
umount2("/proc", MNT_DETACH);
}
static __attribute__((__constructor__))
void emergency_do_mounts(void)
{
struct stat rt, xt;
@ -143,6 +141,12 @@ void emergency_do_mounts(void)
}
}
}
#else /* !USE_SULOGIN_EMERGENCY_MOUNT */
void emergency_do_umounts(void) { }
void emergency_do_mounts(void) { }
#endif /* USE_SULOGIN_EMERGENCY_MOUNT */
/*

View File

@ -21,6 +21,8 @@
*
* Author: Werner Fink <werner@suse.de>
*/
#ifndef UTIL_LINUX_SULOGIN_CONSOLES_H
#define UTIL_LINUX_SULOGIN_CONSOLES_H
#include <sys/types.h>
#include <stdint.h>
@ -45,3 +47,8 @@ struct console {
extern int detect_consoles(const char *device, int fallback,
struct list_head *consoles);
extern void emergency_do_umounts(void);
extern void emergency_do_mounts(void);
#endif /* UTIL_LINUX_SULOGIN_CONSOLES_H */

View File

@ -834,6 +834,10 @@ int main(int argc, char **argv)
mask_signal(SIGINT, SIG_IGN, &saved_sigint);
mask_signal(SIGHUP, SIG_IGN, &saved_sighup);
emergency_do_mounts();
atexit( emergency_do_umounts );
/*
* See if we need to open an other tty device.
*/