summaryrefslogtreecommitdiffstats
path: root/login-utils/checktty.c
diff options
context:
space:
mode:
authorSamuel Thibault2007-11-28 10:40:32 +0100
committerKarel Zak2007-11-28 10:41:26 +0100
commite460a5bf893227ccd7cdc9b8e5beec1ebc30a858 (patch)
tree0a3e4f29b76835d95a4d890efd935b6a1fdb7297 /login-utils/checktty.c
parentfdisk: non-linux support (MAXPATHLEN) (diff)
downloadkernel-qcow2-util-linux-e460a5bf893227ccd7cdc9b8e5beec1ebc30a858.tar.gz
kernel-qcow2-util-linux-e460a5bf893227ccd7cdc9b8e5beec1ebc30a858.tar.xz
kernel-qcow2-util-linux-e460a5bf893227ccd7cdc9b8e5beec1ebc30a858.zip
build-sys: cleanup usage of linux/major.h
The utils like fdisk or login are usable on non-linux systems. This patch allows to compile on systems without linux/major.h. Signed-off-by: Karel Zak <kzak@redhat.com> Signed-off-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
Diffstat (limited to 'login-utils/checktty.c')
-rw-r--r--login-utils/checktty.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/login-utils/checktty.c b/login-utils/checktty.c
index 16f9f2e88..c28ee833d 100644
--- a/login-utils/checktty.c
+++ b/login-utils/checktty.c
@@ -25,12 +25,18 @@
#include "nls.h"
#include <sys/sysmacros.h>
+#ifdef HAVE_LINUX_MAJOR_H
#include <linux/major.h>
+#endif
#include "pathnames.h"
#include "login.h"
#include "xstrncpy.h"
+#ifndef TTY_MAJOR
+#define TTY_MAJOR 4
+#endif
+
static gid_t mygroups[NGROUPS];
static int num_groups;
@@ -118,6 +124,7 @@ add_to_class(struct ttyclass *tc, char *tty)
static int
isapty(const char *tty)
{
+#ifdef __linux__
char devname[100];
struct stat stb;
@@ -147,6 +154,7 @@ isapty(const char *tty)
#endif
}
+#endif /* __linux__ */
return 0;
}