Skip to content
Toggle navigation
Toggle navigation
This project
Loading...
Sign in
John McEleney
/
mailutils
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Network
Create a new issue
Builds
Commits
Issue Boards
Files
Commits
Network
Compare
Branches
Tags
Commit
34554b52
...
34554b5234db91e5b79f88c8e2cb0ae82a87e6a2
authored
2002-01-17 22:30:55 +0000
by
Sergey Poznyakoff
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
Use mu_tempfile.
1 parent
f5edbeda
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
7 additions
and
47 deletions
guimb/collect.c
mail/send.c
mail/var.c
mailbox/body.c
mailbox/mbx_mh.c
guimb/collect.c
View file @
34554b5
...
...
@@ -52,7 +52,7 @@ collect_open_mailbox_file ()
int
fd
;
/* Create input mailbox */
fd
=
util_tempfile
(
&
temp_filename
);
fd
=
mu_tempfile
(
NULL
,
&
temp_filename
);
if
(
fd
==
-
1
)
exit
(
1
);
...
...
mail/send.c
View file @
34554b5
...
...
@@ -136,7 +136,7 @@ mail_send0 (struct send_environ *env, int save_to)
char
*
savefile
=
NULL
;
int
int_cnt
;
fd
=
util_tempfile
(
&
filename
);
fd
=
mu_tempfile
(
NULL
,
&
filename
);
if
(
fd
==
-
1
)
{
...
...
mail/var.c
View file @
34554b5
...
...
@@ -443,7 +443,7 @@ var_pipe(int argc, char **argv, struct send_environ *env)
return
1
;
}
fd
=
util_tempfile
(
NULL
);
fd
=
mu_tempfile
(
NULL
,
NULL
);
if
(
fd
==
-
1
)
return
1
;
...
...
mailbox/body.c
View file @
34554b5
...
...
@@ -29,6 +29,7 @@
#include <fcntl.h>
#include <mailutils/stream.h>
#include <mailutils/mutil.h>
#include <body0.h>
#define BODY_MODIFIED 0x10000
...
...
@@ -346,22 +347,5 @@ _body_get_lines0 (stream_t stream, size_t *plines)
static
int
lazy_create
(
body_t
body
)
{
const
char
*
tmpdir
=
getenv
(
"TMPDIR"
);
int
fd
;
if
(
tmpdir
==
NULL
)
tmpdir
=
P_tmpdir
;
body
->
filename
=
calloc
(
strlen
(
tmpdir
)
+
1
+
/* "muXXXXXX" */
8
+
1
,
sizeof
(
char
));
if
(
body
->
filename
==
NULL
)
return
ENOMEM
;
sprintf
(
body
->
filename
,
"%s/muXXXXXX"
,
tmpdir
);
#ifdef HAVE_MKSTEMP
fd
=
mkstemp
(
body
->
filename
);
#else
if
(
mktemp
(
body
->
filename
))
fd
=
open
(
body
->
filename
,
O_RDWR
|
O_CREAT
|
O_EXCL
,
0600
);
else
fd
=
-
1
;
#endif
return
fd
;
return
mu_tempfile
(
NULL
,
&
body
->
filename
);
}
...
...
mailbox/mbx_mh.c
View file @
34554b5
...
...
@@ -50,6 +50,7 @@
#include <mailutils/header.h>
#include <mailutils/attribute.h>
#include <mailutils/error.h>
#include <mailutils/mutil.h>
#include <registrar0.h>
#include <mailbox0.h>
...
...
@@ -447,34 +448,9 @@ _mh_next_seq (struct _mh_data *mhd)
static
FILE
*
_mh_tempfile
(
struct
_mh_data
*
mhd
,
char
**
namep
)
{
char
*
filename
;
int
fd
;
filename
=
malloc
(
strlen
(
mhd
->
name
)
+
/*'/'*/
1
+
/* "muXXXXXX" */
8
+
1
);
if
(
!
filename
)
return
NULL
;
sprintf
(
filename
,
"%s/muXXXXXX"
,
mhd
->
name
);
#ifdef HAVE_MKSTEMP
{
int
save_mask
=
umask
(
077
);
fd
=
mkstemp
(
filename
);
umask
(
save_mask
);
}
#else
if
(
mktemp
(
filename
))
fd
=
open
(
filename
,
O_CREAT
|
O_EXCL
|
O_RDWR
,
0600
);
else
fd
=
-
1
;
#endif
int
fd
=
mu_tempfile
(
mhd
->
name
,
namep
);
if
(
fd
==
-
1
)
{
free
(
filename
);
return
NULL
;
}
*
namep
=
filename
;
return
fdopen
(
fd
,
"w"
);
}
...
...
Please
register
or
sign in
to post a comment