Projects STRLCPY criu Commits 48373432
🤬
Revision indexing in progress... (symbol navigation in revisions will be accurate after indexed)
  • ■ ■ ■ ■ ■ ■
    criu/namespaces.c
    skipped 283 lines
    284 284   
    285 285  int switch_mnt_ns(int pid, int *rst, int *cwd_fd)
    286 286  {
    287  - int ret;
    288 287   int fd;
    289 288   
    290 289   if (!cwd_fd)
    skipped 2 lines
    293 292   fd = open(".", O_PATH);
    294 293   if (fd < 0) {
    295 294   pr_perror("unable to open current directory");
    296  - return fd;
     295 + return -1;
    297 296   }
    298 297   
    299  - ret = switch_ns(pid, &mnt_ns_desc, rst);
    300  - if (ret < 0) {
     298 + if (switch_ns(pid, &mnt_ns_desc, rst)) {
    301 299   close(fd);
    302  - return ret;
     300 + return -1;
    303 301   }
    304 302   
    305 303   *cwd_fd = fd;
    skipped 2 lines
    308 306   
    309 307  int restore_mnt_ns(int rst, int *cwd_fd)
    310 308  {
    311  - int ret = -1;
     309 + int exit_code = -1;
    312 310   
    313  - ret = restore_ns(rst, &mnt_ns_desc);
    314  - if (ret < 0)
     311 + if (restore_ns(rst, &mnt_ns_desc))
    315 312   goto err_restore;
    316 313   
    317  - if (cwd_fd) {
    318  - ret = fchdir(*cwd_fd);
    319  - if (ret)
    320  - pr_perror("unable to restore current directory");
     314 + if (cwd_fd && fchdir(*cwd_fd)) {
     315 + pr_perror("Unable to restore current directory");
     316 + goto err_restore;
    321 317   }
    322 318   
     319 + exit_code = 0;
    323 320  err_restore:
    324 321   if (cwd_fd)
    325 322   close_safe(cwd_fd);
    326 323   
    327  - return ret;
     324 + return exit_code;
    328 325  }
    329 326   
    330 327  struct ns_id *ns_ids = NULL;
    skipped 1593 lines
Please wait...
Page is in error, reload to recover