cu coredumps

Mark Cullen mark.cullen at dsl.pipex.com
Wed Oct 27 08:54:44 PDT 2004


Matthew Dillon wrote:
:Just saw your commit. You say it still won't work with no /dev/ prefix? 
:With FreeBSD 4.10-STABLE it doesn't coredump with no /dev/ prefix, it 
:doesn't have the added check in hunt.c either! In fact, hunt.c looks 
:exactly the same as in DF before the commit.
:
:(root|bone)/home/mrboo# cu -l cuaa1
:Connected.
:
:Not really hard to type the extra /dev/, but I just thought I would let 
:you know anyway :)
:-- 
:Internet Explorer? Try FireFox at http://www.mozilla.org/products/firefox/

    They probably prefix the buffer with '/dev' in code, but if people want
    that in DragonFly someone is going to have to do the work and submit it
    because I really need to get back to work on VFS.
Sorry for the nagging. I had a go at prefixing /dev/ to the string 
myself ( bet you weren't expecting that huh! :) ), although I am no 
great C coder by any means.

Maybe someone could take a look at it? (and laugh at the mess I made no 
doubt) After my changes:

(root|beast)/usr/src/usr.bin/tip/tip# cu -l cuaa1
Connected
(root|beast)/usr/src/usr.bin/tip/tip# cu -l /devv/cuaa1
cu: /devv/cuaa1: No such file or directory
link down
(root|beast)/usr/src/usr.bin/tip/tip# cu -l /dev/cuaa1
Connected
(root|beast)/usr/src/usr.bin/tip/tip#
So... it seems to be working. Oh and I figured the FreeBSD version of cu 
was working fine because it wasn't actually using the new tip cu 
interface stuff by the way. The size of cu on FreeBSD was about 10k and 
the date was back in May (updated to stable the other day, so it 
obviously hadn't been rebuilt using tip)

Anyway, (attempt at a) patch below. I think I made a bit of a mess of 
the whole strlen stuff maybe. Not too sure about that..

Thanks

------ hunt.c patch ------

--- hunt.c.old  2004-10-27 16:44:06.000000000 +0100
+++ hunt.c      2004-10-27 16:51:11.000000000 +0100
@@ -58,17 +58,30 @@
 hunt(name)
        char *name;
 {
-       register char *cp;
+       register char *cp, *tmp_cp;
        sig_t f;
-       int res;
+       int res, cp_len = 0;
        f = signal(SIGALRM, dead);
        while ((cp = getremote(name))) {
+               cp_len = strlen(cp) + strlen("/dev/") + 1;
+               tmp_cp = malloc(sizeof(char) * cp_len);
+
                deadfl = 0;
-               if ((uucplock = strrchr(cp, '/')) == NULL)
-                       uucplock = cp;
-               else
+               if ((uucplock = strrchr(cp, '/')) == NULL) {
+                       strncpy(tmp_cp, "/dev/", 6);
+                       strncat(tmp_cp, cp, strlen(cp));
+                       cp = tmp_cp;
+
+                       if ((uucplock = strrchr(cp, '/')) == NULL) {
+                               uucplock = cp;
+                       } else {
+                               ++uucplock;
+                       }
+               } else {
                        ++uucplock;
+               }
+
                if ((res = uu_lock(uucplock)) != UU_LOCK_OK) {
                        if (res != UU_LOCK_INUSE)
                                fprintf(stderr, "uu_lock: %s\n", 
uu_lockerr(res));

------ end patch ------

					-Matt
					Matthew Dillon 
					<dillon at xxxxxxxxxxxxx>

--
Internet Explorer? Try FireFox at http://www.mozilla.org/products/firefox/
Outlook Express? Try ThunderBird at 
http://www.mozilla.org/products/thunderbird/





More information about the Bugs mailing list