Fix tempnam
This commit is contained in:
parent
4e258474cc
commit
817269426c
33
www/bluefish/patches/patch-src_bf_lib_c
Normal file
33
www/bluefish/patches/patch-src_bf_lib_c
Normal file
@ -0,0 +1,33 @@
|
||||
$OpenBSD: patch-src_bf_lib_c,v 1.1 2002/09/05 18:17:02 couderc Exp $
|
||||
--- src/bf_lib.c.orig Tue Jul 24 15:03:46 2001
|
||||
+++ src/bf_lib.c Thu Jul 18 16:19:27 2002
|
||||
@@ -580,21 +580,17 @@ gint get_int_from_string(gchar *string)
|
||||
*/
|
||||
gchar *create_secure_dir_return_filename() {
|
||||
gchar *name, *name2;
|
||||
- DEBUG_MSG("create_secure_dir_return_filename,g_get_tmp_dir()=%s\n", g_get_tmp_dir());
|
||||
- name = tempnam(g_get_tmp_dir(), NULL);
|
||||
- DEBUG_MSG("create_secure_dir_return_filename, name=%s\n", name);
|
||||
- if (!name) {
|
||||
- return NULL;
|
||||
- }
|
||||
+ char tfn[255] = "";
|
||||
|
||||
- if (mkdir(name, 0700) != 0) {
|
||||
- g_free(name);
|
||||
+ DEBUG_MSG("create_secure_dir_return_filename,g_get_tmp_dir()=%s\n", g_get_tmp_dir());
|
||||
+ snprintf(tfn, sizeof(tfn), "%s/bluefish.XXXXXXXX", (char *) g_get_tmp_dir());
|
||||
+ name = (gchar *) mkstemp(tfn);
|
||||
+ if (name == -1) {
|
||||
return NULL;
|
||||
+ } else {
|
||||
+ DEBUG_MSG("create_secure_dir_return_filename, name=%s\n", name);
|
||||
+ return name;
|
||||
}
|
||||
- name2 = tempnam(name, NULL);
|
||||
- DEBUG_MSG("create_secure_dir_return_filename, name2=%s\n", name2);
|
||||
- g_free(name);
|
||||
- return name2;
|
||||
}
|
||||
|
||||
void remove_secure_dir_and_filename(gchar *filename) {
|
Loading…
Reference in New Issue
Block a user