emacs-diffs
[Top][All Lists]
Advanced

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

[Emacs-diffs] /srv/bzr/emacs/trunk r109035: Port 'movemail' again to Sol


From: Paul Eggert
Subject: [Emacs-diffs] /srv/bzr/emacs/trunk r109035: Port 'movemail' again to Solaris and similar hosts.
Date: Wed, 11 Jul 2012 15:44:07 -0700
User-agent: Bazaar (2.5.0)

------------------------------------------------------------
revno: 109035
committer: Paul Eggert <address@hidden>
branch nick: trunk
timestamp: Wed 2012-07-11 15:44:07 -0700
message:
  Port 'movemail' again to Solaris and similar hosts.
  
  See Susan Cragin's report in
  <http://lists.gnu.org/archive/html/emacs-devel/2012-07/msg00199.html>.
  * movemail.c (xmalloc): Also define if !DISABLE_DIRECT_ACCESS &&
  !MAIL_USE_MMDF && !MAIL_USE_SYSTEM_LOCK.  Move up, so it doesn't
  need a forward declaration.
  (main): Rewrite to avoid no-longer-present function 'concat', if
  !DISABLE_DIRECT_ACCESS && !MAIL_USE_MMDF && !MAIL_USE_SYSTEM_LOCK.
modified:
  lib-src/ChangeLog
  lib-src/movemail.c
=== modified file 'lib-src/ChangeLog'
--- a/lib-src/ChangeLog 2012-07-11 05:44:06 +0000
+++ b/lib-src/ChangeLog 2012-07-11 22:44:07 +0000
@@ -1,5 +1,14 @@
 2012-07-11  Paul Eggert  <address@hidden>
 
+       Port 'movemail' again to Solaris and similar hosts.
+       See Susan Cragin's report in
+       <http://lists.gnu.org/archive/html/emacs-devel/2012-07/msg00199.html>.
+       * movemail.c (xmalloc): Also define if !DISABLE_DIRECT_ACCESS &&
+       !MAIL_USE_MMDF && !MAIL_USE_SYSTEM_LOCK.  Move up, so it doesn't
+       need a forward declaration.
+       (main): Rewrite to avoid no-longer-present function 'concat', if
+       !DISABLE_DIRECT_ACCESS && !MAIL_USE_MMDF && !MAIL_USE_SYSTEM_LOCK.
+
        Assume strerror.
        * emacsclient.c, movemail.c, update-game-score.c (strerror)
        [!HAVE_STRERROR]: Remove.

=== modified file 'lib-src/movemail.c'
--- a/lib-src/movemail.c        2012-07-11 05:44:06 +0000
+++ b/lib-src/movemail.c        2012-07-11 22:44:07 +0000
@@ -137,9 +137,6 @@
 static void error (const char *s1, const char *s2, const char *s3);
 static _Noreturn void pfatal_with_name (char *name);
 static _Noreturn void pfatal_and_delete (char *name);
-#ifdef MAIL_USE_MAILLOCK
-static void *xmalloc (size_t size);
-#endif
 #ifdef MAIL_USE_POP
 static int popmail (char *mailbox, char *outfile, int preserve, char 
*password, int reverse_order);
 static int pop_retr (popserver server, int msgno, FILE *arg);
@@ -148,6 +145,21 @@
 static int mbx_delimit_end (FILE *mbf);
 #endif
 
+#if (MAIL_USE_MAILLOCK                                                 \
+     || (!defined DISABLE_DIRECT_ACCESS && !defined MAIL_USE_MMDF      \
+        && !defined MAIL_USE_SYSTEM_LOCK))
+/* Like malloc but get fatal error if memory is exhausted.  */
+
+static void *
+xmalloc (size_t size)
+{
+  void *result = malloc (size);
+  if (!result)
+    fatal ("virtual memory exhausted", 0, 0);
+  return result;
+}
+#endif
+
 /* Nonzero means this is name of a lock file to delete on fatal error.  */
 static char *delete_lockname;
 
@@ -165,7 +177,7 @@
   int tem;
   char *lockname;
   char *tempname;
-  size_t inname_dirlen;
+  size_t inname_len, inname_dirlen;
   int desc;
 #endif /* not MAIL_USE_SYSTEM_LOCK */
 
@@ -293,8 +305,11 @@
         should define MAIL_USE_SYSTEM_LOCK but does not, send a bug report
         to address@hidden so we can fix it.  */
 
-      lockname = concat (inname, ".lock", "");
-      for (inname_dirlen = strlen (inname);
+      inname_len = strlen (inname);
+      lockname = xmalloc (inname_len + sizeof ".lock");
+      strcpy (lockname, inname);
+      strcpy (lockname + inname_len, ".lock");
+      for (inname_dirlen = inname_len;
           inname_dirlen && !IS_DIRECTORY_SEP (inname[inname_dirlen - 1]);
           inname_dirlen--)
        continue;
@@ -640,19 +655,6 @@
   unlink (name);
   fatal ("%s for %s", s, name);
 }
-
-#ifdef MAIL_USE_MAILLOCK
-/* Like malloc but get fatal error if memory is exhausted.  */
-
-static void *
-xmalloc (size_t size)
-{
-  void *result = malloc (size);
-  if (!result)
-    fatal ("virtual memory exhausted", 0, 0);
-  return result;
-}
-#endif
 
 /* This is the guts of the interface to the Post Office Protocol.  */
 


reply via email to

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