qemacs-commit
[Top][All Lists]
Advanced

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

[Qemacs-commit] qemacs qe.c shell.c


From: Charlie Gordon
Subject: [Qemacs-commit] qemacs qe.c shell.c
Date: Mon, 9 Apr 2018 10:41:58 -0400 (EDT)

CVSROOT:        /sources/qemacs
Module name:    qemacs
Changes by:     Charlie Gordon <chqrlie>        18/04/09 10:41:58

Modified files:
        .              : qe.c shell.c 

Log message:
        fix linux compilation warnings

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/qemacs/qe.c?cvsroot=qemacs&r1=1.289&r2=1.290
http://cvs.savannah.gnu.org/viewcvs/qemacs/shell.c?cvsroot=qemacs&r1=1.137&r2=1.138

Patches:
Index: qe.c
===================================================================
RCS file: /sources/qemacs/qemacs/qe.c,v
retrieving revision 1.289
retrieving revision 1.290
diff -u -b -r1.289 -r1.290
--- qe.c        22 Jun 2017 22:02:25 -0000      1.289
+++ qe.c        9 Apr 2018 14:41:58 -0000       1.290
@@ -530,7 +530,9 @@
     if (chdir(buf)) {
         put_status(s, "Cannot change directory to '%s'", buf);
     } else {
-        getcwd(buf, sizeof(buf));
+        if (!getcwd(buf, sizeof(buf)))
+            put_status(s, "Cannot get current directory");
+        else
         put_status(s, "Current directory: %s", buf);
     }
 }
@@ -6792,7 +6794,8 @@
         } else {
             /* CG: not sufficient for windows drives */
             if (!b || !get_default_path(b, offset, cwd, sizeof(cwd))) {
-                getcwd(cwd, sizeof(cwd));
+                if (!getcwd(cwd, sizeof(cwd)))
+                    strcpy(cwd, ".");
 #ifdef CONFIG_WIN32
                 path_win_to_unix(cwd);
 #endif

Index: shell.c
===================================================================
RCS file: /sources/qemacs/qemacs/shell.c,v
retrieving revision 1.137
retrieving revision 1.138
diff -u -b -r1.137 -r1.138
--- shell.c     11 Feb 2018 11:44:18 -0000      1.137
+++ shell.c     9 Apr 2018 14:41:58 -0000       1.138
@@ -215,6 +215,7 @@
         /* child process */
         const char *argv[4];
         int argc = 0;
+        int fd0, fd1, fd2;
 
         argv[argc++] = get_shell();
         if (cmd) {
@@ -235,14 +236,17 @@
         /* open pseudo tty for standard I/O */
         if (shell_flags & SF_INTERACTIVE) {
             /* interactive shell: input from / output to pseudo terminal */
-            open(tty_name, O_RDWR);
-            dup(0);
-            dup(0);
+            fd0 = open(tty_name, O_RDWR);
+            fd1 = dup(0);
+            fd2 = dup(0);
         } else {
             /* collect output from non interactive process: no input */
-            open("/dev/null", O_RDONLY);
-            open(tty_name, O_RDWR);
-            dup(1);
+            fd0 = open("/dev/null", O_RDONLY);
+            fd1 = open(tty_name, O_RDWR);
+            fd2 = dup(1);
+        }
+        if (fd0 != 0 || fd1 != 1 || fd2 != 2) {
+            setenv("QE-STATUS", "invalid handles", 1);
         }
 #ifdef CONFIG_DARWIN
         setsid();
@@ -259,7 +263,11 @@
         unsetenv("PAGER");
         //setenv("QELEVEL", "1", 1);
 
-        if (path) chdir(path);
+        if (path) {
+            if (chdir(path)) {
+                setenv("QE-STATUS", "cannot chdir", 1);
+            }
+        }
 
         execv(argv[0], (char * const*)argv);
         exit(1);
@@ -1453,7 +1461,7 @@
             /* XXX: should just force top of window to in infinite scroll mode 
*/
             {   /*     0: Below (default), 1: Above, 2: All, 3: Saved Lines 
(xterm) */
                 /* XXX: should handle eol style */
-                int offset0, offset1, bos, eos, col, row;
+                int offset0, bos, eos, col, row;
 
                 bos = eos = 0;
                 // default param is 0
@@ -1472,7 +1480,7 @@
                 /* update cursor as overwriting characters may change offsets 
*/
                 if (bos) {
                     qe_term_get_pos(s, offset, &offset0, &col, &row);
-                    offset1 = eb_goto_bol(s->b, offset);
+                    eb_goto_bol(s->b, offset);
                     qe_term_set_style(s);
                     if (row > 0) {
                         offset = qe_term_delete_lines(s, offset0, row);



reply via email to

[Prev in Thread] Current Thread [Next in Thread]