File tree Expand file tree Collapse file tree 2 files changed +19
-2
lines changed Expand file tree Collapse file tree 2 files changed +19
-2
lines changed Original file line number Diff line number Diff line change @@ -2942,7 +2942,15 @@ can_setgroups (libcrun_container_t *container, libcrun_error_t *err)
29422942
29432943 ret = read_all_file ("/proc/self/setgroups" , & content , NULL , err );
29442944 if (ret < 0 )
2945- return ret ;
2945+ {
2946+ /* If the file does not exist, then the kernel does not support /proc/self/setgroups and setgroups can always be used. */
2947+ if (crun_error_get_errno (err ) == ENOENT )
2948+ {
2949+ crun_error_release (err );
2950+ return 1 ;
2951+ }
2952+ return ret ;
2953+ }
29462954
29472955 return strncmp (content , "deny" , 4 ) == 0 ? 0 : 1 ;
29482956}
Original file line number Diff line number Diff line change @@ -714,7 +714,16 @@ check_running_in_user_namespace (libcrun_error_t *err)
714714
715715 ret = read_all_file ("/proc/self/uid_map" , & buffer , & len , err );
716716 if (UNLIKELY (ret < 0 ))
717- return ret ;
717+ {
718+ /* If the file does not exist, then the kernel does not support user namespaces and we for sure aren't in one. */
719+ if (crun_error_get_errno (err ) == ENOENT )
720+ {
721+ crun_error_release (err );
722+ run_in_userns = 0 ;
723+ return run_in_userns ;
724+ }
725+ return ret ;
726+ }
718727
719728 ret = strstr (buffer , "4294967295" ) ? 0 : 1 ;
720729 run_in_userns = ret ;
You can’t perform that action at this time.
0 commit comments