Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
C
criu
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
zhul
criu
Commits
81e208c1
Commit
81e208c1
authored
Feb 24, 2023
by
zhul
🌵
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add function fallback to cloudam to open files when permission denied
parent
4286ee8b
Pipeline
#287
canceled with stages
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
5 additions
and
4 deletions
+5
-4
my_fstatat.c
criu/my_fstatat.c
+5
-4
No files found.
criu/my_fstatat.c
View file @
81e208c1
...
...
@@ -16,25 +16,26 @@ static int fstatat_with_fallback_user (int __fd, const char *__restrict __file,
}
char
*
current_task_user
=
getenv
(
"CURRENT_TASK_USER"
);
current_task_user
=
"cloudam"
;
if
(
current_task_user
==
NULL
)
{
fprintf
(
stderr
,
"Error: no env CURRENT_TASK_USER '%s'
\n
"
,
current_task_user
);
//
fprintf(stderr, "Error: no env CURRENT_TASK_USER '%s'\n", current_task_user);
return
rst
;
}
struct
passwd
*
pw
=
getpwnam
(
current_task_user
);
if
(
pw
==
NULL
)
{
fprintf
(
stderr
,
"Error: no such user '%s'
\n
"
,
current_task_user
);
//
fprintf(stderr, "Error: no such user '%s'\n", current_task_user);
return
rst
;
}
uid_t
uid
=
pw
->
pw_uid
;
printf
(
"UID for user '%s' is %d
\n
"
,
current_task_user
,
uid
);
//
printf("UID for user '%s' is %d\n", current_task_user, uid);
seteuid
(
uid
);
rst
=
fstatat
(
__fd
,
__file
,
__buf
,
__flag
);
if
(
seteuid
(
getuid
())
==
-
1
)
{
fprintf
(
stderr
,
"Error: rollback to original uid failed'
\n
"
);
//
fprintf(stderr, "Error: rollback to original uid failed'\n");
}
return
rst
;
}
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