summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGuillaume Cottenceau <gc@mandriva.com>2001-05-15 11:28:03 +0000
committerGuillaume Cottenceau <gc@mandriva.com>2001-05-15 11:28:03 +0000
commit158dc80bcd864eda64578c838cd76f72ab76086d (patch)
tree7c5aed20a3a7e5a1f6640d8aabf58228a04782d4
parentafd9291ef3d0279b49de38fceac5f11b8ba54360 (diff)
downloaddrakx-backup-do-not-use-158dc80bcd864eda64578c838cd76f72ab76086d.tar
drakx-backup-do-not-use-158dc80bcd864eda64578c838cd76f72ab76086d.tar.gz
drakx-backup-do-not-use-158dc80bcd864eda64578c838cd76f72ab76086d.tar.bz2
drakx-backup-do-not-use-158dc80bcd864eda64578c838cd76f72ab76086d.tar.xz
drakx-backup-do-not-use-158dc80bcd864eda64578c838cd76f72ab76086d.zip
- build glibc and dietlibc targets
- bzero string buffer before sscanf call (dietlibc implementation) - verify returns of ioperm so that I can use it in test mode
-rw-r--r--mdk-stage1/pcmcia/Makefile22
-rw-r--r--mdk-stage1/pcmcia/cardmgr.c6
-rw-r--r--mdk-stage1/pcmcia/pcmcia_probe.c11
3 files changed, 30 insertions, 9 deletions
diff --git a/mdk-stage1/pcmcia/Makefile b/mdk-stage1/pcmcia/Makefile
index e2e670146..fb93f10b8 100644
--- a/mdk-stage1/pcmcia/Makefile
+++ b/mdk-stage1/pcmcia/Makefile
@@ -18,17 +18,31 @@ top_dir = ..
include $(top_dir)/Makefile.common
-all: libpcmcia.a
+all: libpcmcia.a libpcmcia-DIET.a
clean:
rm -f *.o libpcmcia.a
FLAGS = -Wall -Werror -Os -fomit-frame-pointer -pipe -c -I..
-libpcmcia.a: pcmcia_probe.o cardmgr.o lex_config.o yacc_config.o
+
+OBJS = pcmcia_probe.o cardmgr.o lex_config.o yacc_config.o
+
+OBJS-DIET = $(subst .o,-DIET.o,$(OBJS))
+
+
+libpcmcia.a: $(OBJS)
ar -cru $@ $^
ranlib $@
-.c.o:
- gcc $(FLAGS) $(GLIBC_INCLUDES) $<
+libpcmcia-DIET.a: $(OBJS-DIET)
+ ar -cru $@ $^
+ ranlib $@
+
+
+$(OBJS): %.o: %.c
+ gcc $(FLAGS) $(GLIBC_INCLUDES) -c $< -o $@
+
+$(OBJS-DIET): %-DIET.o: %.c
+ gcc $(FLAGS) $(DIETLIBC_INCLUDES) -c $< -o $@
diff --git a/mdk-stage1/pcmcia/cardmgr.c b/mdk-stage1/pcmcia/cardmgr.c
index 1899d04b8..f461ed180 100644
--- a/mdk-stage1/pcmcia/cardmgr.c
+++ b/mdk-stage1/pcmcia/cardmgr.c
@@ -133,6 +133,7 @@ static int lookup_dev(char *name)
if (f == NULL)
return -errno;
while (fgets(s, 32, f) != NULL) {
+ bzero(t, 32);
if (sscanf(s, "%d %s", &n, t) == 2)
if (strcmp(name, t) == 0)
break;
@@ -146,10 +147,9 @@ static int lookup_dev(char *name)
static int open_dev(dev_t dev, int mode)
{
- char *fn;
+ char * fn = "/tmp/cardmgr_tmp";
int fd;
- if ((fn = tmpnam(NULL)) == NULL)
- return -1;
+ unlink(fn);
if (mknod(fn, mode, dev) != 0)
return -1;
fd = open(fn, (mode&S_IWRITE) ? O_RDWR : O_RDONLY);
diff --git a/mdk-stage1/pcmcia/pcmcia_probe.c b/mdk-stage1/pcmcia/pcmcia_probe.c
index 4cd88d4eb..0d9dd7462 100644
--- a/mdk-stage1/pcmcia/pcmcia_probe.c
+++ b/mdk-stage1/pcmcia/pcmcia_probe.c
@@ -187,7 +187,10 @@ static int i365_probe(void)
log_message("PCMCIA: probing for Intel PCIC (ISA)..");
sock = done = 0;
- ioperm(i365_base, 4, 1);
+ if (ioperm(i365_base, 4, 1)) {
+ log_perror("PCMCIA: ioperm");
+ return -1;
+ }
ioperm(0x80, 1, 1);
for (; sock < 2; sock++) {
val = i365_get(sock, I365_IDENT);
@@ -344,7 +347,11 @@ static int tcic_probe(void)
log_message("PCMCIA: probing for Databook TCIC-2 (ISA)..");
- ioperm(TCIC_BASE, 16, 1);
+ if (ioperm(TCIC_BASE, 16, 1)) {
+ log_perror("PCMCIA: ioperm");
+ return -1;
+ }
+
ioperm(0x80, 1, 1);
sock = tcic_probe_at(TCIC_BASE);