Date: Mon, 03 Jul 2000 00:29:56 +0900 From: "Daniel C. Sobral" <dcs@newsguy.com> To: Brad Knowles <blk@skynet.be> Cc: FreeBSD-STABLE Mailing List <freebsd-stable@FreeBSD.ORG>, Jens A Nilsson <jnilsson@ludd.luth.se> Subject: Re: regcomp(3) acting weird? Message-ID: <395F5FF4.B2FA7753@newsguy.com> References: <v0422080bb57fdaa5baf2@[195.238.1.121]>
next in thread | previous in thread | raw e-mail | index | archive | help
Brad Knowles wrote: > > sps->sps_reg_errno = regcomp(&sps->sps_reg, sps->sps_name, cflags); > if (sps->sps_reg_errno != 0) { This is where you should place some helpful printfs, but your problem isn't here. For one thing... > free(sps); > return NULL; Notice how it frees sps and returns NULL in case of error, so one would never be able to retrieve the error anyway. For another thing, > However, spegla dies while trying to parse it: > > $ /usr/local/bin/spegla -f /usr/local/etc/spegla/interplay.conf > spegla: sps_init: Undefined error: 0 ^ > The section of spegla.c that is calling this routine is: > > /* ARGSUSED */ > static void > add_param_sps(int option, const char *arg, struct cl_sps_que **q) > { > struct sp_skip *sps; > > option = 0; /* quiet gcc */ > if (*q == NULL && ((*q = cl_sps_init()) == NULL)) > e_err(1, "cl_sps_init"); > if ((sps = sps_init(arg)) == NULL) > e_err(1, "sps_init"); ^^^^^^^^^^ > if (sps_error(sps)) > e_errx(1, "sps_init: %s", sps_strerror(sps)); ^ > (void) cl_sps_push(*q, sps); > } See how the error seems not to be a result of sps_init(), but of sps_error(). Could you please post sps_error() and struct sp_sip definition? -- Daniel C. Sobral (8-DCS) dcs@newsguy.com dcs@freebsd.org capo@the.great.underground.bsdconpiracy.org <jkh> _DES: The Book of Bruce has only one sentence in it, and it says "the actual directives of my cult are left as an exercise for the reader. Good luck." <EE> jkh: does it really include the 'good luck' part? <jkh> EE: OK, I made that part up. <jkh> EE: I figured it should sound a bit more cheery than how Bruce initially dictated it to me. To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-stable" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?395F5FF4.B2FA7753>