Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
A
asn1c
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Libraries
asn1c
Commits
da672c41
Commit
da672c41
authored
Nov 18, 2017
by
Lev Walkin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
better error reporting when destination directory is not available
parent
4645db07
Changes
2
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
119 additions
and
96 deletions
+119
-96
libasn1compiler/asn1c_compat.c
libasn1compiler/asn1c_compat.c
+17
-10
libasn1compiler/asn1c_save.c
libasn1compiler/asn1c_save.c
+102
-86
No files found.
libasn1compiler/asn1c_compat.c
View file @
da672c41
...
@@ -36,8 +36,9 @@ int mkstemp(char *template) {
...
@@ -36,8 +36,9 @@ int mkstemp(char *template) {
#endif
#endif
FILE
*
FILE
*
asn1c_open_file
(
const
char
*
destdir
,
const
char
*
name
,
const
char
*
ext
,
char
**
opt_tmpname
)
{
asn1c_open_file
(
const
char
*
destdir
,
const
char
*
name
,
const
char
*
ext
,
char
fname
[
PATH_MAX
];
char
**
opt_tmpname
)
{
char
fname
[
PATH_MAX
];
int
created
=
1
;
int
created
=
1
;
#ifndef _WIN32
#ifndef _WIN32
struct
stat
sb
;
struct
stat
sb
;
...
@@ -49,10 +50,8 @@ asn1c_open_file(const char* destdir, const char *name, const char *ext, char **o
...
@@ -49,10 +50,8 @@ asn1c_open_file(const char* destdir, const char *name, const char *ext, char **o
/*
/*
* Compute filenames.
* Compute filenames.
*/
*/
ret
=
snprintf
(
fname
,
sizeof
(
fname
),
"%s%s%s%s"
,
ret
=
snprintf
(
fname
,
sizeof
(
fname
),
"%s%s%s%s"
,
destdir
?
destdir
:
""
,
opt_tmpname
?
""
:
destdir
,
name
,
ext
,
opt_tmpname
?
".XXXXXX"
:
""
);
name
,
ext
,
opt_tmpname
?
".XXXXXX"
:
""
);
assert
(
ret
>
0
&&
ret
<
(
ssize_t
)
sizeof
(
fname
));
assert
(
ret
>
0
&&
ret
<
(
ssize_t
)
sizeof
(
fname
));
if
(
opt_tmpname
)
{
if
(
opt_tmpname
)
{
...
@@ -61,8 +60,10 @@ asn1c_open_file(const char* destdir, const char *name, const char *ext, char **o
...
@@ -61,8 +60,10 @@ asn1c_open_file(const char* destdir, const char *name, const char *ext, char **o
*/
*/
fd
=
mkstemp
(
fname
);
fd
=
mkstemp
(
fname
);
#ifndef _WIN32
#ifndef _WIN32
/* fchmod() does not respect umask */
if
(
fd
!=
-
1
)
{
(
void
)
fchmod
(
fd
,
REASONABLE_FILE_MODE
);
/* fchmod() does not respect umask */
(
void
)
fchmod
(
fd
,
REASONABLE_FILE_MODE
);
}
#endif
#endif
}
else
{
}
else
{
/*
/*
...
@@ -75,8 +76,14 @@ asn1c_open_file(const char* destdir, const char *name, const char *ext, char **o
...
@@ -75,8 +76,14 @@ asn1c_open_file(const char* destdir, const char *name, const char *ext, char **o
}
}
}
}
if
(
fd
==
-
1
)
{
if
(
fd
==
-
1
)
{
perror
(
fname
);
struct
stat
st
;
return
NULL
;
if
(
destdir
&&
stat
(
destdir
,
&
st
)
==
-
1
)
{
fprintf
(
stderr
,
"%s: No such directory
\n
"
,
destdir
);
return
NULL
;
}
else
{
perror
(
fname
);
return
NULL
;
}
}
}
#ifndef _WIN32
#ifndef _WIN32
...
...
libasn1compiler/asn1c_save.c
View file @
da672c41
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment