aboutsummaryrefslogtreecommitdiffstats
path: root/lib-src/emacsclient.c
diff options
context:
space:
mode:
Diffstat (limited to 'lib-src/emacsclient.c')
-rw-r--r--lib-src/emacsclient.c27
1 files changed, 4 insertions, 23 deletions
diff --git a/lib-src/emacsclient.c b/lib-src/emacsclient.c
index 8d60d7961da..021ac6eb247 100644
--- a/lib-src/emacsclient.c
+++ b/lib-src/emacsclient.c
@@ -88,10 +88,7 @@ char *w32_getenv (char *);
88 88
89 89
90 90
91char *getenv (const char *), *getwd (char *); 91char *getenv (const char *);
92#ifdef HAVE_GETCWD
93char *(getcwd) (char *, size_t);
94#endif
95 92
96#ifndef VERSION 93#ifndef VERSION
97#define VERSION "unspecified" 94#define VERSION "unspecified"
@@ -223,7 +220,7 @@ get_current_dir_name (void)
223 char *buf; 220 char *buf;
224 const char *pwd; 221 const char *pwd;
225 struct stat dotstat, pwdstat; 222 struct stat dotstat, pwdstat;
226 /* If PWD is accurate, use it instead of calling getwd. PWD is 223 /* If PWD is accurate, use it instead of calling getcwd. PWD is
227 sometimes a nicer name, and using it may avoid a fatal error if a 224 sometimes a nicer name, and using it may avoid a fatal error if a
228 parent directory is searchable but not readable. */ 225 parent directory is searchable but not readable. */
229 if ((pwd = egetenv ("PWD")) != 0 226 if ((pwd = egetenv ("PWD")) != 0
@@ -240,7 +237,6 @@ get_current_dir_name (void)
240 buf = (char *) xmalloc (strlen (pwd) + 1); 237 buf = (char *) xmalloc (strlen (pwd) + 1);
241 strcpy (buf, pwd); 238 strcpy (buf, pwd);
242 } 239 }
243#ifdef HAVE_GETCWD
244 else 240 else
245 { 241 {
246 size_t buf_size = 1024; 242 size_t buf_size = 1024;
@@ -267,20 +263,6 @@ get_current_dir_name (void)
267 } 263 }
268 } 264 }
269 } 265 }
270#else
271 else
272 {
273 /* We need MAXPATHLEN here. */
274 buf = (char *) xmalloc (MAXPATHLEN + 1);
275 if (getwd (buf) == NULL)
276 {
277 int tmp_errno = errno;
278 free (buf);
279 errno = tmp_errno;
280 return NULL;
281 }
282 }
283#endif
284 return buf; 266 return buf;
285} 267}
286#endif 268#endif
@@ -1138,7 +1120,7 @@ handle_sigcont (int signalnum)
1138 else 1120 else
1139 { 1121 {
1140 /* We are in the background; cancel the continue. */ 1122 /* We are in the background; cancel the continue. */
1141 kill (getpid (), SIGSTOP); 1123 raise (SIGSTOP);
1142 } 1124 }
1143 1125
1144 signal (signalnum, handle_sigcont); 1126 signal (signalnum, handle_sigcont);
@@ -1165,7 +1147,7 @@ handle_sigtstp (int signalnum)
1165 sigprocmask (SIG_BLOCK, NULL, &set); 1147 sigprocmask (SIG_BLOCK, NULL, &set);
1166 sigdelset (&set, signalnum); 1148 sigdelset (&set, signalnum);
1167 signal (signalnum, SIG_DFL); 1149 signal (signalnum, SIG_DFL);
1168 kill (getpid (), signalnum); 1150 raise (signalnum);
1169 sigprocmask (SIG_SETMASK, &set, NULL); /* Let's the above signal through. */ 1151 sigprocmask (SIG_SETMASK, &set, NULL); /* Let's the above signal through. */
1170 signal (signalnum, handle_sigtstp); 1152 signal (signalnum, handle_sigtstp);
1171 1153
@@ -1592,7 +1574,6 @@ main (int argc, char **argv)
1592 cwd = get_current_dir_name (); 1574 cwd = get_current_dir_name ();
1593 if (cwd == 0) 1575 if (cwd == 0)
1594 { 1576 {
1595 /* getwd puts message in STRING if it fails. */
1596 message (TRUE, "%s: %s\n", progname, 1577 message (TRUE, "%s: %s\n", progname,
1597 "Cannot get current working directory"); 1578 "Cannot get current working directory");
1598 fail (); 1579 fail ();