[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: New Quik available



Hello Daniel,

I think I found the problem.

In second, subroutine main, get_params is called to get the device,
partition number, etc., but get_params has no intelligent default
partition (just what's specified in the conf file or on the command
line, see line 258 of main.c).  So if the partition is not specified, it
goes to parse_name, which gives an arbitrary default partition number of
2 (line 82 of main.c).

I've attached a patch which makes everything work.  The two single-line
hunks for second/main.c set the default image partition to
fip->conf_part instead of the arbitrary "2".  The multi-line hunk for
second/main.c clarifies what "part" is, this was confusing to me.  And
the hunk for quik/quik.c (the same one I sent earlier) enables symlinks
from root which don't start with '/'.

Possible changes: you may feel "defpart = *part;" in get_params should
be somewhere else, like at the beginning; and you might want to set part
to -1 at the beginning of main in case fip->conf_part can't be trusted
(though I don't see why, but there must be some reason it's not passed
to get_params).

This makes everything work for me.  If it does not cause breakage
elsewhere, please merge the changes with the Debian package and/or
upstream.  If others could test, that would help a lot.

Thank you again,

-Adam P.

--- quik/quik.c.bak	Thu Apr  6 13:08:02 2000
+++ quik/quik.c	Thu Apr  6 13:11:25 2000
@@ -381,18 +381,22 @@
 	    return q;
 	}
 	if (S_ISLNK(st3.st_mode)) {
-	    len = readlink(buffer, readlinkbuf, 2048);
+	    len = readlink(buffer, readlinkbuf+1, 2047);
 	    if (len < 0)
 		fatal ("Couldn't readlink %s\n", fn);
-	    readlinkbuf[len] = 0;
-	    if (*readlinkbuf == '/') {
+	    readlinkbuf[len+1] = 0;
+	    if (*(readlinkbuf+1) == '/') {
+		b = r = readlinkbuf+1;
+	    } else if (p == buffer + 1) {
+		*readlinkbuf = '/';
 		b = r = readlinkbuf;
+		len++;
 	    } else {
 		b = buffer2;
 		strcpy (b, buffer);
 		r = strchr(b, 0);
 		*r++ = '/';
-		strcpy(r, readlinkbuf);
+		strcpy(r, readlinkbuf+1);
 	    }
 	    if (c) {
 		r += len;
--- second/main.c.bak	Sun Apr  9 10:52:05 2000
+++ second/main.c	Sun Apr  9 11:17:57 2000
@@ -269,6 +269,7 @@
 	    label = imagename;
 	    imagename = p;
 	    defdevice = cfg_get_strg(label, "device");
+	    defpart = *part;
 	    p = cfg_get_strg(label, "partition");
 	    if (p) {
 		n = strtol(p, &endp, 10);
@@ -297,9 +298,9 @@
 	*device = defdevice;
     if (!*kname)
 	    printf(
-"Enter the kernel image name as [device:][partno]/path, where partno is a\n"
-"number from 0 to 16.  Instead of /path you can type [mm-nn] to specify a\n"
-"range of disk blocks (512B)\n");
+"Enter the kernel image name as [device:][partno]/path, where partno is the\n"
+"partition number from 0 to 16.  Instead of /path you can type [mm-nn] to\n"
+"specify a range of disk blocks (512B)\n");
 
     return 0;
 }
@@ -421,6 +422,8 @@
 	}
     } else
 	printf ("\n");
+
+    part = fip->conf_part;
 
     for (;;) {
 	get_params(&device, &part, &kname, &params);


Reply to: