Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
O
OpenXG-RAN
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
promise
OpenXG-RAN
Commits
9e432086
Commit
9e432086
authored
Aug 21, 2020
by
Robert Schmidt
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
FlexRAN control delegation: write/remove depending if payload present
parent
6e2c8d84
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
36 additions
and
29 deletions
+36
-29
openair2/ENB_APP/flexran_agent_common.c
openair2/ENB_APP/flexran_agent_common.c
+36
-29
No files found.
openair2/ENB_APP/flexran_agent_common.c
View file @
9e432086
...
@@ -434,40 +434,47 @@ int flexran_agent_control_delegation(mid_t mod_id, const void *params, Protocol_
...
@@ -434,40 +434,47 @@ int flexran_agent_control_delegation(mid_t mod_id, const void *params, Protocol_
RC
.
flexran
[
mod_id
]
->
cache_name
,
RC
.
flexran
[
mod_id
]
->
cache_name
,
control_delegation_msg
->
name
);
control_delegation_msg
->
name
);
if
(
len
>=
sizeof
(
target
))
{
if
(
len
>=
sizeof
(
target
))
{
LOG_E
(
FLEXRAN_AGENT
,
"target has been truncated, cannot write file
\n
"
);
LOG_E
(
FLEXRAN_AGENT
,
"target has been truncated, cannot write file
name
\n
"
);
return
0
;
return
0
;
}
}
/* use low-level API: check whether exists while creating so we can abort if
if
(
control_delegation_msg
->
has_payload
)
{
* it exists to not overwrite anything */
/* use low-level API: check whether exists while creating so we can abort if
int
fd
=
open
(
target
,
O_CREAT
|
O_WRONLY
|
O_EXCL
,
S_IRUSR
|
S_IWUSR
);
* it exists to not overwrite anything */
if
(
fd
>=
0
)
{
int
fd
=
open
(
target
,
O_CREAT
|
O_WRONLY
|
O_EXCL
,
S_IRUSR
|
S_IWUSR
);
ssize_t
l
=
write
(
fd
,
if
(
fd
>=
0
)
{
control_delegation_msg
->
payload
.
data
,
ssize_t
l
=
write
(
fd
,
control_delegation_msg
->
payload
.
len
);
control_delegation_msg
->
payload
.
data
,
close
(
fd
);
control_delegation_msg
->
payload
.
len
);
if
(
l
<
control_delegation_msg
->
payload
.
len
)
{
close
(
fd
);
LOG_E
(
FLEXRAN_AGENT
,
if
(
l
<
control_delegation_msg
->
payload
.
len
)
{
"could not write complete control delegation to %s: only %ld out of "
LOG_E
(
FLEXRAN_AGENT
,
"%ld bytes
\n
"
,
"could not write complete control delegation to %s: only %ld out of "
target
,
"%ld bytes
\n
"
,
l
,
target
,
control_delegation_msg
->
payload
.
len
);
l
,
return
0
;
control_delegation_msg
->
payload
.
len
);
}
else
if
(
l
<
0
)
{
return
0
;
LOG_E
(
FLEXRAN_AGENT
,
"can not write control delegation data to %s: %s
\n
"
,
}
else
if
(
l
<
0
)
{
target
,
strerror
(
errno
));
LOG_E
(
FLEXRAN_AGENT
,
"can not write control delegation data to %s: %s
\n
"
,
return
0
;
target
,
strerror
(
errno
));
}
return
0
;
LOG_I
(
FLEXRAN_AGENT
,
"wrote shared object %s
\n
"
,
target
);
}
}
else
{
LOG_I
(
FLEXRAN_AGENT
,
"wrote shared object %s
\n
"
,
target
);
if
(
errno
==
EEXIST
)
{
LOG_I
(
FLEXRAN_AGENT
,
"file %s already exists, remove it first
\n
"
,
target
);
}
else
{
}
else
{
LOG_E
(
FLEXRAN_AGENT
,
"can not write control delegation data to %s: %s
\n
"
,
if
(
errno
==
EEXIST
)
{
target
,
strerror
(
errno
));
LOG_I
(
FLEXRAN_AGENT
,
"file %s already exists, remove it first
\n
"
,
target
);
return
0
;
}
else
{
LOG_E
(
FLEXRAN_AGENT
,
"can not write control delegation data to %s: %s
\n
"
,
target
,
strerror
(
errno
));
return
0
;
}
}
}
}
else
{
LOG_W
(
FLEXRAN_AGENT
,
"remove file %s
\n
"
,
target
);
int
rc
=
remove
(
target
);
if
(
rc
<
0
)
LOG_E
(
FLEXRAN_AGENT
,
"cannot remove file %s: %s
\n
"
,
target
,
strerror
(
errno
));
}
}
return
0
;
return
0
;
...
...
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