[sac-dev] Bugs found
Kuang He
icrazy at gmail.com
Sun Sep 7 20:34:03 PDT 2008
On Sat, Sep 6, 2008 at 2:06 AM, Kuang He <icrazy at gmail.com> wrote:
> I'm using SAC v101.1 on a linux box (Ubuntu 8.04), and the glibc
> version is 2.7 (2.7-10ubuntu3, to be exact).
>
> $ uname -a
> Linux ....... 2.6.24-19-generic #1 SMP Fri Jul 11 23:41:49 UTC 2008
> i686 GNU/Linux
>
> Bug 1: Trying to use Ctrl+D to quit SAC instead of using the command
> `quit' will always cause a segmentation fault.
>
> $ sac
> SAC> [Press CTRL+D]
> Segmentation fault
Here is a quick fix to Bug 1 (based on SAC v101.1):
$ diff -u src/co/zgpmsg.c.old src/co/zgpmsg.c
--- src/co/zgpmsg.c.old 2008-09-07 23:18:09.000000000 -0400
+++ src/co/zgpmsg.c 2008-09-07 23:28:07.000000000 -0400
@@ -96,6 +96,14 @@
process_line(char *p) {
int i;
+ if (p == NULL) { /* user has pressed CTRL+D */
+ if ((p = malloc(5)) == NULL) {
+ printf("%s:%d: error allocating p.\n", __FILE__, __LINE__);
+ exit(1);
+ }
+ strncpy(p, "quit", 4);
+ p[4] = '\0';
+ }
select_loop_continue(SELECT_OFF); /* Turn off select loop */
select_loop_message(p, SELECT_MSG_SET); /* Set the outgoing message */
Probably there are better ways to do this.
There is another file src/co/zgpmsg.c, which seems to be an old
version of src/co/zgpmsg.c, and is still in the Makefile. Do I need to
change this file as well? Please advise.
Best regards,
--
Kuang He
Department of Physics
University of Connecticut
Storrs, CT 06269-3046
Tel: +1.860.486.4919
Web: http://www.phys.uconn.edu/~he/
More information about the sac-dev
mailing list