]> code.delx.au - gnu-emacs/blobdiff - lib-src/movemail.c
A few tiny doc/ copyedits.
[gnu-emacs] / lib-src / movemail.c
index 81ac8aa187c1a0bdef8219b66c440e843b98107d..d0d00fcf4cc089c34cfd10442d88b527f9c15c9e 100644 (file)
@@ -1,7 +1,7 @@
 /* movemail foo bar -- move file foo to file bar,
    locking file foo the way /bin/mail respects.
 
-Copyright (C) 1986, 1992-1994, 1996, 1999, 2001-2013 Free Software
+Copyright (C) 1986, 1992-1994, 1996, 1999, 2001-2014 Free Software
 Foundation, Inc.
 
 This file is part of GNU Emacs.
@@ -304,24 +304,13 @@ main (int argc, char **argv)
 
          memcpy (tempname, inname, inname_dirlen);
          strcpy (tempname + inname_dirlen, "EXXXXXX");
-#ifdef HAVE_MKSTEMP
-         desc = mkstemp (tempname);
-#else
-         mktemp (tempname);
-         if (!*tempname)
-           desc = -1;
-         else
-           {
-             unlink (tempname);
-             desc = open (tempname, O_WRONLY | O_CREAT | O_EXCL, 0600);
-           }
-#endif
+         desc = mkostemp (tempname, 0);
          if (desc < 0)
            {
-             int mkstemp_errno = errno;
+             int mkostemp_errno = errno;
              error ("error while creating what would become the lock file",
                     0, 0);
-             errno = mkstemp_errno;
+             errno = mkostemp_errno;
              pfatal_with_name (tempname);
            }
          close (desc);