This repository was archived by the owner on Feb 8, 2021. It is now read-only.
File tree Expand file tree Collapse file tree 2 files changed +11
-6
lines changed Expand file tree Collapse file tree 2 files changed +11
-6
lines changed Original file line number Diff line number Diff line change @@ -313,16 +313,12 @@ static int container_setup_mount(struct hyper_container *container)
313313 return -1 ;
314314 }
315315
316- if (unlink ("./dev/ptmx" ) < 0 ) {
317- perror ("remove /dev/ptmx failed" );
318- return -1 ;
319- }
320- if (symlink ("/dev/pts/ptmx" , "./dev/ptmx" ) < 0 ) {
316+ /* all containers share the same devtmpfs, so we need to ignore the errno EEXIST */
317+ if (symlink ("/dev/pts/ptmx" , "./dev/ptmx" ) < 0 && errno != EEXIST ) {
321318 perror ("link /dev/pts/ptmx to /dev/ptmx failed" );
322319 return -1 ;
323320 }
324321
325- /* all containers share the same devtmpfs, so we need to ignore the errno EEXIST */
326322 if ((symlink ("/proc/self/fd" , "./dev/fd" ) < 0 && errno != EEXIST ) ||
327323 (symlink ("/proc/self/fd/0" , "./dev/stdin" ) < 0 && errno != EEXIST ) ||
328324 (symlink ("/proc/self/fd/1" , "./dev/stdout" ) < 0 && errno != EEXIST ) ||
Original file line number Diff line number Diff line change @@ -1380,6 +1380,15 @@ int main(int argc, char *argv[])
13801380 return -1 ;
13811381 }
13821382
1383+ if (unlink ("/dev/ptmx" ) < 0 ) {
1384+ perror ("remove /dev/ptmx failed" );
1385+ return -1 ;
1386+ }
1387+ if (symlink ("/dev/pts/ptmx" , "/dev/ptmx" ) < 0 ) {
1388+ perror ("link /dev/pts/ptmx to /dev/ptmx failed" );
1389+ return -1 ;
1390+ }
1391+
13831392 cmdline = read_cmdline ();
13841393
13851394 setsid ();
You can’t perform that action at this time.
0 commit comments