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
4ec65fa5
...
4ec65fa5ac0400d23bc9bf78e6f6f81be6170112
authored
2002-08-23 06:53:02 +0000
by
Sergey Poznyakoff
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
Do not use asprintf.
1 parent
8004e37a
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
30 additions
and
12 deletions
mailbox/mu_argp.c
mailbox/mutil.c
mailbox/mu_argp.c
View file @
4ec65fa
...
...
@@ -44,7 +44,6 @@
#include <mailutils/mailbox.h>
#include <argcv.h>
#include <mu_asprintf.h>
#define ARG_LOG_FACILITY 1
#define ARG_LOCK_FLAGS 2
...
...
@@ -638,15 +637,20 @@ mu_create_argcv (const char *capa[],
}
else
{
char
*
userrc
=
NULL
;
char
*
userrc
=
NULL
;
mu_asprintf
(
&
userrc
,
"%s/mailutils"
,
MU_USER_CONFIG_FILE
);
userrc
=
malloc
(
sizeof
(
MU_USER_CONFIG_FILE
)
/* provides an extra slot
for null byte as well */
+
1
/* slash */
+
9
/*mailutils*/
);
if
(
!
userrc
)
{
fprintf
(
stderr
,
"%s: not enough memory
\n
"
,
progname
);
exit
(
1
);
}
sprintf
(
userrc
,
"%s/mailutils"
,
MU_USER_CONFIG_FILE
);
read_rc
(
progname
,
userrc
,
capa
,
&
x_argc
,
&
x_argv
);
free
(
userrc
);
...
...
@@ -654,12 +658,20 @@ mu_create_argcv (const char *capa[],
/* Add per-user, per-program config file. */
{
char
*
progrc
=
NULL
;
char
*
progrc
=
NULL
;
int
size
;
if
(
rcdir
)
mu_asprintf
(
&
progrc
,
"%s/%src"
,
MU_USER_CONFIG_FILE
,
progname
);
if
(
rcdir
)
size
=
sizeof
(
MU_USER_CONFIG_FILE
)
+
1
+
strlen
(
progname
)
+
2
/* rc */
;
else
mu_asprintf
(
&
progrc
,
"~/.mu.%src"
,
progname
);
size
=
6
/*~/.mu.*/
+
strlen
(
progname
)
+
3
/* "rc" + null terminator */
;
progrc
=
malloc
(
size
);
if
(
!
progrc
)
{
...
...
@@ -667,6 +679,11 @@ mu_create_argcv (const char *capa[],
exit
(
1
);
}
if
(
rcdir
)
sprintf
(
progrc
,
"%s/%src"
,
MU_USER_CONFIG_FILE
,
progname
);
else
sprintf
(
progrc
,
"~/.mu.%src"
,
progname
);
read_rc
(
NULL
,
progrc
,
capa
,
&
x_argc
,
&
x_argv
);
free
(
progrc
);
}
...
...
mailbox/mutil.c
View file @
4ec65fa
...
...
@@ -47,8 +47,6 @@
#include <mailutils/parse822.h>
#include <mailutils/mu_auth.h>
#include "mu_asprintf.h"
/* convert a sequence of hex characters into an integer */
unsigned
long
...
...
@@ -595,12 +593,15 @@ mu_get_user_email (const char *name)
return
NULL
;
}
mu_asprintf
(
&
email
,
"%s@%s"
,
localpart
,
domainpart
);
free
(
localpart
);
email
=
malloc
(
strlen
(
localpart
)
+
1
+
strlen
(
domainpart
)
+
1
);
if
(
!
email
)
errno
=
ENOMEM
;
else
sprintf
(
email
,
"%s@%s"
,
localpart
,
domainpart
);
free
(
localpart
);
return
email
;
}
...
...
Please
register
or
sign in
to post a comment