8860d27e1b
Added patches from debian to handle wrong configure check The update should fix PR 31629
37 lines
1.1 KiB
Text
37 lines
1.1 KiB
Text
$NetBSD: patch-ae,v 1.2 2005/10/16 19:28:03 tonio Exp $
|
|
|
|
--- src/hooks/gaduhook.cc.orig 2005-08-25 23:39:36.000000000 +0200
|
|
+++ src/hooks/gaduhook.cc
|
|
@@ -893,6 +893,7 @@ static char *token_ocr(const char *ocr,
|
|
string gaduhook::handletoken(struct gg_http *h) {
|
|
struct gg_token *t;
|
|
string fname, r;
|
|
+ char *tmpfilep = NULL;
|
|
|
|
if(!h)
|
|
return "";
|
|
@@ -907,8 +908,22 @@ string gaduhook::handletoken(struct gg_h
|
|
return "";
|
|
|
|
do {
|
|
- fname = (getenv("TMPDIR") ? getenv("TMPDIR") : "/tmp");
|
|
- fname += "/gg.token." + i2str(getpid()) + i2str(time(0));
|
|
+ while (tmpfilep == NULL) {
|
|
+ char tmpnam[100];
|
|
+ int tmpfiledes;
|
|
+ if (getenv("TMPDIR") && strlen(getenv("TMPDIR")) < 50)
|
|
+ sprintf (tmpnam, "%s/gg.token.XXXXXX", getenv("TMPDIR"));
|
|
+ else
|
|
+ sprintf (tmpnam, "/tmp/gg.token.XXXXXX");
|
|
+
|
|
+ if ((tmpfilep = mktemp (tmpnam)) != NULL) {
|
|
+ if ((tmpfiledes = open (tmpnam, O_CREAT | O_EXCL, S_IREAD | S_IWRITE)) == -1)
|
|
+ tmpfilep = NULL;
|
|
+ else
|
|
+ close (tmpfiledes);
|
|
+ }
|
|
+ fname = tmpnam;
|
|
+ }
|
|
} while(!access(fname.c_str(), F_OK));
|
|
|
|
ofstream bf(fname.c_str());
|