* cygwin.din (fpurge, mkstemps): New exports.
* include/cygwin/version.h (CYGWIN_VERSION_API_MINOR): Bump. * mktemp.cc (_gettemp): Add parameter. (mkstemps): New function. (mkstemp, mkdtemp, mktemp): Adjust clients.
This commit is contained in:
parent
c52ac05c3a
commit
e5f37aa148
|
@ -1,3 +1,19 @@
|
||||||
|
2009-07-03 Eric Blake <ebb9@byu.net>
|
||||||
|
|
||||||
|
* cygwin.din (fpurge, mkstemps): New exports.
|
||||||
|
* include/cygwin/version.h (CYGWIN_VERSION_API_MINOR): Bump.
|
||||||
|
* mktemp.cc (_gettemp): Add parameter.
|
||||||
|
(mkstemps): New function.
|
||||||
|
(mkstemp, mkdtemp, mktemp): Adjust clients.
|
||||||
|
|
||||||
|
2009-07-03 Corinna Vinschen <corinna@vinschen.de>
|
||||||
|
|
||||||
|
* autoload.cc: Fix typo in comment.
|
||||||
|
(ShowWindowAsync): Define.
|
||||||
|
(AttachConsole): Define.
|
||||||
|
* fhandler_console.cc (fhandler_console::need_invisible): Add band-aid
|
||||||
|
for Windows 7 AllocConsole bug.
|
||||||
|
|
||||||
2009-07-01 Corinna Vinschen <corinna@vinschen.de>
|
2009-07-01 Corinna Vinschen <corinna@vinschen.de>
|
||||||
|
|
||||||
* net.cc (get_xp_ifs): Fix typo in comment.
|
* net.cc (get_xp_ifs): Fix typo in comment.
|
||||||
|
|
|
@ -505,6 +505,7 @@ __fpclassifyd NOSIGFE
|
||||||
__fpclassifyf NOSIGFE
|
__fpclassifyf NOSIGFE
|
||||||
fprintf SIGFE
|
fprintf SIGFE
|
||||||
_fprintf = fprintf SIGFE
|
_fprintf = fprintf SIGFE
|
||||||
|
fpurge SIGFE
|
||||||
fputc SIGFE
|
fputc SIGFE
|
||||||
_fputc = fputc SIGFE
|
_fputc = fputc SIGFE
|
||||||
fputs SIGFE
|
fputs SIGFE
|
||||||
|
@ -984,6 +985,7 @@ _mknod32 = mknod32 SIGFE
|
||||||
mknodat SIGFE
|
mknodat SIGFE
|
||||||
mkstemp SIGFE
|
mkstemp SIGFE
|
||||||
_mkstemp = mkstemp SIGFE
|
_mkstemp = mkstemp SIGFE
|
||||||
|
mkstemps SIGFE
|
||||||
mktemp SIGFE
|
mktemp SIGFE
|
||||||
_mktemp = mktemp SIGFE
|
_mktemp = mktemp SIGFE
|
||||||
mktime SIGFE
|
mktime SIGFE
|
||||||
|
|
|
@ -364,12 +364,13 @@ details. */
|
||||||
208: Export log2, log2f.
|
208: Export log2, log2f.
|
||||||
209: Export wordexp, wordfree.
|
209: Export wordexp, wordfree.
|
||||||
210: New ctype layout using variable ctype pointer. Export __ctype_ptr__.
|
210: New ctype layout using variable ctype pointer. Export __ctype_ptr__.
|
||||||
|
211: Export fpurge, mkstemps.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* Note that we forgot to bump the api for ualarm, strtoll, strtoull */
|
/* Note that we forgot to bump the api for ualarm, strtoll, strtoull */
|
||||||
|
|
||||||
#define CYGWIN_VERSION_API_MAJOR 0
|
#define CYGWIN_VERSION_API_MAJOR 0
|
||||||
#define CYGWIN_VERSION_API_MINOR 210
|
#define CYGWIN_VERSION_API_MINOR 211
|
||||||
|
|
||||||
/* There is also a compatibity version number associated with the
|
/* There is also a compatibity version number associated with the
|
||||||
shared memory regions. It is incremented when incompatible
|
shared memory regions. It is incremented when incompatible
|
||||||
|
|
|
@ -1,15 +1,16 @@
|
||||||
/* mktemp.cc: mktemp functions
|
/* mktemp.cc: mktemp functions
|
||||||
|
|
||||||
This file is adapted for Cygwin from FreeBSD.
|
This file is adapted for Cygwin from FreeBSD and newlib.
|
||||||
|
|
||||||
See the copyright at the bottom of this file. */
|
See the copyright at the bottom of this file. */
|
||||||
|
|
||||||
#include "winsup.h"
|
#include "winsup.h"
|
||||||
#include "cygerrno.h"
|
#include "cygerrno.h"
|
||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
|
#include <sys/stat.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
|
||||||
static int _gettemp(char *, int *, int);
|
static int _gettemp(char *, int *, int, size_t);
|
||||||
static uint32_t arc4random ();
|
static uint32_t arc4random ();
|
||||||
|
|
||||||
static const char padchar[] =
|
static const char padchar[] =
|
||||||
|
@ -19,23 +20,30 @@ extern "C" int
|
||||||
mkstemp(char *path)
|
mkstemp(char *path)
|
||||||
{
|
{
|
||||||
int fd;
|
int fd;
|
||||||
return _gettemp(path, &fd, 0) ? fd : -1;
|
return _gettemp(path, &fd, 0, 0) ? fd : -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
extern "C" char *
|
extern "C" char *
|
||||||
mkdtemp(char *path)
|
mkdtemp(char *path)
|
||||||
{
|
{
|
||||||
return _gettemp(path, NULL, 1) ? path : NULL;
|
return _gettemp(path, NULL, 1, 0) ? path : NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
extern "C" int
|
||||||
|
mkstemps(char *path, int len)
|
||||||
|
{
|
||||||
|
int fd;
|
||||||
|
return _gettemp(path, &fd, 0, len) ? fd : -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
extern "C" char *
|
extern "C" char *
|
||||||
mktemp(char *path)
|
mktemp(char *path)
|
||||||
{
|
{
|
||||||
return _gettemp(path, NULL, 0) ? path : (char *) NULL;
|
return _gettemp(path, NULL, 0, 0) ? path : (char *) NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
_gettemp(char *path, int *doopen, int domkdir)
|
_gettemp(char *path, int *doopen, int domkdir, size_t suffixlen)
|
||||||
{
|
{
|
||||||
char *start, *trv, *suffp;
|
char *start, *trv, *suffp;
|
||||||
char *pad;
|
char *pad;
|
||||||
|
@ -46,12 +54,14 @@ _gettemp(char *path, int *doopen, int domkdir)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
suffp = trv = strchr (path, '\0');
|
trv = strchr (path, '\0');
|
||||||
if (--trv < path)
|
if ((size_t) (trv - path) < suffixlen)
|
||||||
{
|
{
|
||||||
set_errno (EINVAL);
|
set_errno (EINVAL);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
trv -= suffixlen;
|
||||||
|
suffp = trv--;
|
||||||
|
|
||||||
/* Fill space with random characters */
|
/* Fill space with random characters */
|
||||||
while (trv >= path && *trv == 'X')
|
while (trv >= path && *trv == 'X')
|
||||||
|
@ -59,6 +69,11 @@ _gettemp(char *path, int *doopen, int domkdir)
|
||||||
uint32_t rand = arc4random () % (sizeof (padchar) - 1);
|
uint32_t rand = arc4random () % (sizeof (padchar) - 1);
|
||||||
*trv-- = padchar[rand];
|
*trv-- = padchar[rand];
|
||||||
}
|
}
|
||||||
|
if (suffp - trv < 6)
|
||||||
|
{
|
||||||
|
set_errno (EINVAL);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
start = trv + 1;
|
start = trv + 1;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
Loading…
Reference in New Issue