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) {
#endif
FILE
*
asn1c_open_file
(
const
char
*
destdir
,
const
char
*
name
,
const
char
*
ext
,
char
**
opt_tmpname
)
{
char
fname
[
PATH_MAX
];
asn1c_open_file
(
const
char
*
destdir
,
const
char
*
name
,
const
char
*
ext
,
char
**
opt_tmpname
)
{
char
fname
[
PATH_MAX
];
int
created
=
1
;
#ifndef _WIN32
struct
stat
sb
;
...
...
@@ -49,10 +50,8 @@ asn1c_open_file(const char* destdir, const char *name, const char *ext, char **o
/*
* Compute filenames.
*/
ret
=
snprintf
(
fname
,
sizeof
(
fname
),
"%s%s%s%s"
,
opt_tmpname
?
""
:
destdir
,
name
,
ext
,
opt_tmpname
?
".XXXXXX"
:
""
);
ret
=
snprintf
(
fname
,
sizeof
(
fname
),
"%s%s%s%s"
,
destdir
?
destdir
:
""
,
name
,
ext
,
opt_tmpname
?
".XXXXXX"
:
""
);
assert
(
ret
>
0
&&
ret
<
(
ssize_t
)
sizeof
(
fname
));
if
(
opt_tmpname
)
{
...
...
@@ -61,8 +60,10 @@ asn1c_open_file(const char* destdir, const char *name, const char *ext, char **o
*/
fd
=
mkstemp
(
fname
);
#ifndef _WIN32
/* fchmod() does not respect umask */
(
void
)
fchmod
(
fd
,
REASONABLE_FILE_MODE
);
if
(
fd
!=
-
1
)
{
/* fchmod() does not respect umask */
(
void
)
fchmod
(
fd
,
REASONABLE_FILE_MODE
);
}
#endif
}
else
{
/*
...
...
@@ -75,8 +76,14 @@ asn1c_open_file(const char* destdir, const char *name, const char *ext, char **o
}
}
if
(
fd
==
-
1
)
{
perror
(
fname
);
return
NULL
;
struct
stat
st
;
if
(
destdir
&&
stat
(
destdir
,
&
st
)
==
-
1
)
{
fprintf
(
stderr
,
"%s: No such directory
\n
"
,
destdir
);
return
NULL
;
}
else
{
perror
(
fname
);
return
NULL
;
}
}
#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