X-Git-Url: http://drtracing.org/?a=blobdiff_plain;f=libiberty%2Fmkstemps.c;h=8a0effdd5bf1c152f02c5f4df38b4b755d6f46d3;hb=2f91880f3afb3cc521111dfcc99b214c77aa97a1;hp=6c2e472528babdfd1da3d18afff2e7ba1beb0a2e;hpb=069c63e246c5cfe7050ff223db625b87e07c019a;p=deliverable%2Fbinutils-gdb.git diff --git a/libiberty/mkstemps.c b/libiberty/mkstemps.c index 6c2e472528..8a0effdd5b 100644 --- a/libiberty/mkstemps.c +++ b/libiberty/mkstemps.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1991, 1992, 1996, 1998, 2004 Free Software Foundation, Inc. +/* Copyright (C) 1991-2017 Free Software Foundation, Inc. This file is derived from mkstemp.c from the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -35,6 +35,8 @@ #endif #ifdef HAVE_SYS_TIME_H #include +#elif HAVE_TIME_H +#include #endif #include "ansidecl.h" @@ -127,6 +129,13 @@ mkstemps (char *pattern, int suffix_len) if (fd >= 0) /* The file does not exist. */ return fd; + if (errno != EEXIST +#ifdef EISDIR + && errno != EISDIR +#endif + ) + /* Fatal error (EPERM, ENOSPC etc). Doesn't make sense to loop. */ + break; /* This is a random value. It is only necessary that the next TMP_MAX values generated by adding 7777 to VALUE are different