errx \
getopt \
getprogname \
+ mkstemp \
strcasecmp \
strlcat \
strnlen \
bc_openTextFile(udbClientTextP ctPtr, char *tmpFileName)
{
int code = 0;
-#ifdef HAVE_MKSTEMP
int fd;
-#endif
if (ctPtr->textStream != NULL) {
fclose(ctPtr->textStream);
}
sprintf(tmpFileName, "%s/bu_XXXXXX", gettmpdir());
-#ifdef HAVE_MKSTEMP
fd = mkstemp(tmpFileName);
if (fd == -1)
ERROR(BUDB_INTERNALERROR);
ctPtr->textStream = fdopen(fd, "w+");
-#else
- mktemp(tmpFileName);
- ctPtr->textStream = fopen(tmpFileName, "w+");
-#endif
if (ctPtr->textStream == NULL)
ERROR(BUDB_INTERNALERROR);
printf("wrote debug file %s\n", filename);
}
-
-#if (defined(AFS_HPUX_ENV)) || defined(AFS_NT40_ENV)
-
-/* mkstemp
- * entry:
- * st - string containing template for a tmp file name
- * exit:
- * -1 - failed
- * 0-n - open file descriptor
- * notes:
- * 1) missing in Ultrix, HP/UX and AIX 221 environment
- * 2) iterate some number of times to alleviate the race?
- */
-
-int
-mkstemp(char *st)
-{
- int retval = -1;
-
-#ifdef AFS_LINUX20_ENV
- retval = open(mkstemp(st), O_RDWR | O_CREAT | O_EXCL, 0600);
-#else
- retval = open(mktemp(st), O_RDWR | O_CREAT | O_EXCL, 0600);
-#endif
-
- return (retval);
-}
-#endif
/* open the text file */
sprintf(filename, "%s/bu_XXXXXX", gettmpdir());
-#if defined (HAVE_MKSTEMP)
fid = mkstemp(filename);
-#else
- fid = open(mktemp(filename), O_RDWR | O_CREAT | O_EXCL, 0600);
-#endif
if (fid < 0) {
ErrorLog(0, rstTapeInfoPtr->taskId, errno, 0,
"Can't open temporary text file: %s\n", filename);
issuid.o: ${UPSTREAM}/issuid.c
$(AFS_CCRULE) $(UPSTREAM)/issuid.c
+mkstemp.o: ${UPSTREAM}/mkstemp.c
+ $(AFS_CCRULE) $(UPSTREAM)/mkstemp.c
+
net_read.o: ${UPSTREAM}/net_read.c
$(AFS_CCRULE) $(UPSTREAM)/net_read.c
$(OUT)\hex.obj \
$(OUT)\issuid.obj \
$(OUT)\localtime_r.obj \
+ $(OUT)\mkstemp.obj \
$(OUT)\net_read.obj \
$(OUT)\net_write.obj \
$(OUT)\snprintf.obj \
rk_optarg @34 DATA
rk_optind @35 DATA
rk_opterr @36 DATA
+ rk_mkstemp @37
+
rk_emalloc;
rk_erealloc;
rk_hex_encode;
+ rk_mkstemp;
rk_print_version;
rk_socket;
rk_strcasecmp;