Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
D
darshan
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
71
Issues
71
List
Boards
Labels
Milestones
Merge Requests
4
Merge Requests
4
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
darshan
darshan
Commits
b5a2087b
Commit
b5a2087b
authored
Feb 22, 2018
by
Philip Carns
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
clean up string handling in darshan_log_put_mounts()
parent
2becd2dc
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
16 additions
and
11 deletions
+16
-11
darshan-util/darshan-logutils.c
darshan-util/darshan-logutils.c
+16
-11
No files found.
darshan-util/darshan-logutils.c
View file @
b5a2087b
...
@@ -477,27 +477,32 @@ int darshan_log_put_mounts(darshan_fd fd, struct darshan_mnt_info *mnt_data_arra
...
@@ -477,27 +477,32 @@ int darshan_log_put_mounts(darshan_fd fd, struct darshan_mnt_info *mnt_data_arra
{
{
struct
darshan_fd_int_state
*
state
=
fd
->
state
;
struct
darshan_fd_int_state
*
state
=
fd
->
state
;
int
i
;
int
i
;
char
line
[
1024
];
char
mnt_dat
[
DARSHAN_EXE_LEN
]
=
{
0
};
char
mnt_dat
[
DARSHAN_EXE_LEN
]
=
{
0
};
int
mnt_dat_sz
=
0
;
char
*
tmp
;
int
ret
;
int
ret
;
int
left
=
DARSHAN_EXE_LEN
;
int
pos
=
0
;
assert
(
state
);
assert
(
state
);
/* write each mount entry to file */
/* write each mount entry to file */
tmp
=
mnt_dat
;
for
(
i
=
count
-
1
;
i
>=
0
;
i
--
)
for
(
i
=
count
-
1
;
i
>=
0
;
i
--
)
{
{
sprintf
(
line
,
"
\n
%s
\t
%s"
,
mnt_data_array
[
i
].
mnt_type
,
mnt_data_array
[
i
].
mnt_path
);
if
((
strlen
(
mnt_data_array
[
i
].
mnt_type
)
+
strlen
(
mnt_data_array
[
i
].
mnt_path
)
+
2
)
<
left
)
{
memcpy
(
tmp
,
line
,
strlen
(
line
));
ret
=
snprintf
(
&
mnt_dat
[
pos
],
left
,
"
\n
%s
\t
%s"
,
mnt_data_array
[
i
].
mnt_type
,
mnt_data_array
[
i
].
mnt_path
);
tmp
+=
strlen
(
line
);
left
-=
ret
;
mnt_dat_sz
+=
strlen
(
line
);
assert
(
left
>=
0
);
pos
+=
ret
;
}
else
{
break
;
}
}
}
pos
++
;
ret
=
darshan_log_dzwrite
(
fd
,
DARSHAN_JOB_REGION_ID
,
mnt_dat
,
mnt_dat_sz
);
ret
=
darshan_log_dzwrite
(
fd
,
DARSHAN_JOB_REGION_ID
,
mnt_dat
,
pos
);
if
(
ret
!=
mnt_dat_sz
)
if
(
ret
!=
pos
)
{
{
state
->
err
=
-
1
;
state
->
err
=
-
1
;
fprintf
(
stderr
,
"Error: failed to write darshan log mount data.
\n
"
);
fprintf
(
stderr
,
"Error: failed to write darshan log mount data.
\n
"
);
...
...
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