diff lib-src/movemail.c @ 604:63a8e7b3c547

*** empty log message ***
author Jim Blandy <jimb@redhat.com>
date Wed, 01 Apr 1992 11:14:15 +0000
parents 3db1540d4b97
children 52d0ff659265
line wrap: on
line diff
--- a/lib-src/movemail.c	Wed Apr 01 10:45:51 1992 +0000
+++ b/lib-src/movemail.c	Wed Apr 01 11:14:15 1992 +0000
@@ -96,7 +96,6 @@
 {
   char *inname, *outname;
   int indesc, outdesc;
-  char buf[1024];
   int nread;
 
 #ifndef MAIL_USE_FLOCK
@@ -182,8 +181,7 @@
      to bug-gnu-emacs@prep.ai.mit.edu so we can fix it.  */
 
   lockname = concat (inname, ".lock", "");
-  tempname = (char *) xmalloc (strlen (inname) + 20);
-  strcpy (tempname, inname);
+  tempname = strcpy (xmalloc (strlen (inname)+1), inname);
   p = tempname + strlen (tempname);
   while (p != tempname && p[-1] != '/')
     p--;
@@ -249,19 +247,23 @@
 #endif
 #endif /* MAIL_USE_FLOCK */
 
-  while (1)
-    {
-      nread = read (indesc, buf, sizeof buf);
-      if (nread != write (outdesc, buf, nread))
-	{
-	  int saved_errno = errno;
-	  unlink (outname);
-	  errno = saved_errno;
-	  pfatal_with_name (outname);
-	}
-      if (nread < sizeof buf)
-	break;
-    }
+  {
+    char buf[1024];
+
+    while (1)
+      {
+	nread = read (indesc, buf, sizeof buf);
+	if (nread != write (outdesc, buf, nread))
+	  {
+	    int saved_errno = errno;
+	    unlink (outname);
+	    errno = saved_errno;
+	    pfatal_with_name (outname);
+	  }
+	if (nread < sizeof buf)
+	  break;
+      }
+  }
 
 #ifdef BSD
   if (fsync (outdesc) < 0)