# HG changeset patch # User Andreas Schwab # Date 1073564432 0 # Node ID fec82b542db2859860745c997b37331d4911c246 # Parent 8bfc55c02f6fb40eafa04a9ccc321c6171461b1d (main): Save errno from socket_status. diff -r 8bfc55c02f6f -r fec82b542db2 lib-src/emacsclient.c --- a/lib-src/emacsclient.c Thu Jan 08 08:40:12 2004 +0000 +++ b/lib-src/emacsclient.c Thu Jan 08 12:20:32 2004 +0000 @@ -358,6 +358,7 @@ { int sock_status = 0; + int saved_errno; if (! socket_name) { @@ -374,6 +375,7 @@ /* See if the socket exists, and if it's owned by us. */ sock_status = socket_status (server.sun_path); + saved_errno = errno; if (sock_status) { /* Failing that, see if LOGNAME or USER exist and differ from @@ -394,6 +396,7 @@ sprintf (server.sun_path, "/tmp/emacs%d-%s/server", (int) pw->pw_uid, system_name); sock_status = socket_status (server.sun_path); + saved_errno = errno; } } } @@ -412,14 +415,14 @@ case 2: /* `stat' failed */ - if (errno == ENOENT) + if (saved_errno == ENOENT) fprintf (stderr, "%s: can't find socket; have you started the server?\n\ To start the server in Emacs, type \"M-x server-start\".\n", argv[0]); else fprintf (stderr, "%s: can't stat %s: %s\n", - argv[0], server.sun_path, strerror (errno)); + argv[0], server.sun_path, strerror (saved_errno)); fail (argc, argv); break; }