Coverity fixes
[sxemacs] / src / emacs.c
index ba27e28..272de9e 100644 (file)
@@ -203,10 +203,6 @@ version 18.59 released October 31, 1992.
 #include <locale.h>
 #endif
 
-#ifdef TOOLTALK
-#include TT_C_H_FILE
-#endif
-
 /* For PATH_EXEC */
 #include <sxe-paths.h>
 
@@ -822,6 +818,7 @@ make_docfile(int c, char **v)
        size_t edlen = XSTRING_LENGTH(Vexec_directory);
        char mdocfile[edlen+countof(make_docfile_prog)];
        char **newargv = xnew_array_and_zero(char*, c), **p;
+       int  ret = -1;
 
        /* set up the program call */
        xstrncpy(mdocfile,
@@ -844,7 +841,9 @@ make_docfile(int c, char **v)
        for (char **o = p, **n = &newargv[1]; *o;) {
                *n++ = *o++;
        }
-       return execv(mdocfile, newargv);
+       ret = execv(mdocfile, newargv);
+       xfree(newargv);
+       return ret;
 }
 
 static inline void*
@@ -1042,7 +1041,8 @@ DOESNT_RETURN main_1(int argc, char **argv, char **envp, int restart)
                        close(1);
                        if (open(term, O_RDWR | OPEN_BINARY, 2) < 0)
                                fatal("%s: %s", term, strerror(errno));
-                       dup(0);
+                       if( dup(0) < 0)
+                               fatal("dup failed %s: %s", term, strerror(errno));
                        if (!isatty(0))
                                fatal("%s: not a tty", term);
 
@@ -1502,10 +1502,6 @@ DOESNT_RETURN main_1(int argc, char **argv, char **envp, int restart)
                syms_of_free_hook();
 #endif
 
-#ifdef TOOLTALK
-               syms_of_tooltalk();
-#endif
-
 #ifdef SUNPRO
                syms_of_sunpro();
 #endif
@@ -1922,10 +1918,6 @@ DOESNT_RETURN main_1(int argc, char **argv, char **envp, int restart)
 #endif                         /* HAVE_CANNA */
 #endif                         /* MULE */
 
-#ifdef TOOLTALK
-               vars_of_tooltalk();
-#endif
-
 #ifdef SUNPRO
                vars_of_sunpro();
 #endif
@@ -2989,14 +2981,6 @@ static void shut_down_emacs(int sig, Lisp_Object stuff, int no_auto_save)
        unlock_all_files();
 #endif
 
-#ifdef TOOLTALK
-       tt_session_quit(tt_default_session());
-#if 0
-       /* The following crashes when built on X11R5 and run on X11R6 */
-       tt_close();
-#endif
-#endif                         /* TOOLTALK */
-
 }
 \f
 #ifndef CANNOT_DUMP