File tree Expand file tree Collapse file tree 1 file changed +3
-0
lines changed Expand file tree Collapse file tree 1 file changed +3
-0
lines changed Original file line number Diff line number Diff line change @@ -92,6 +92,7 @@ int main(int argc,char *argv[])
92
92
{
93
93
if (wcscmp (wargv [2 ],L"--default-user" ) == 0 )
94
94
{
95
+ (void ) ConfigureDistribution (TargetName ,0 ,distributionFlags ); //set default uid to 0(root)
95
96
FILE * fp ;
96
97
unsigned long uid ;
97
98
wchar_t wcmd [300 ] = L"wsl.exe " ;
@@ -112,13 +113,15 @@ int main(int argc,char *argv[])
112
113
res = ConfigureDistribution (TargetName ,uid ,distributionFlags );
113
114
if (res != 0 )
114
115
{
116
+ (void ) ConfigureDistribution (TargetName ,defaultUID ,distributionFlags ); //revert uid
115
117
fwprintf (stderr ,L"ERROR:Configure Failed! 0x%x" ,res );
116
118
return 1 ;
117
119
}
118
120
return 0 ;
119
121
}
120
122
else
121
123
{
124
+ (void ) ConfigureDistribution (TargetName ,defaultUID ,distributionFlags ); //revert uid
122
125
wprintf (L"\n" );
123
126
fwprintf (stderr ,L"ERROR:Invalid Argument.\nFailed to detect user." );
124
127
}
You can’t perform that action at this time.
0 commit comments