Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 24238
b: refs/heads/master
c: 1fbbd68
h: refs/heads/master
v: v3
  • Loading branch information
Jeff Dike authored and Linus Torvalds committed Mar 27, 2006
1 parent c41488b commit f27623e
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 11 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 98c18238f146a9038098244d60a7d2b1f67ee790
refs/heads/master: 1fbbd6844e6a84e5d166ab475dc298d3b89fa4bf
33 changes: 23 additions & 10 deletions trunk/arch/um/os-Linux/umid.c
Original file line number Diff line number Diff line change
Expand Up @@ -143,8 +143,10 @@ static int not_dead_yet(char *dir)
goto out_close;
}

if((kill(p, 0) == 0) || (errno != ESRCH))
if((kill(p, 0) == 0) || (errno != ESRCH)){
printk("umid \"%s\" is already in use by pid %d\n", umid, p);
return 1;
}

err = actually_do_remove(dir);
if(err)
Expand Down Expand Up @@ -234,33 +236,44 @@ int __init make_umid(void)
err = mkdir(tmp, 0777);
if(err < 0){
err = -errno;
if(errno != EEXIST)
if(err != -EEXIST)
goto err;

if(not_dead_yet(tmp) < 0)
/* 1 -> this umid is already in use
* < 0 -> we couldn't remove the umid directory
* In either case, we can't use this umid, so return -EEXIST.
*/
if(not_dead_yet(tmp) != 0)
goto err;

err = mkdir(tmp, 0777);
}
if(err < 0){
printk("Failed to create '%s' - err = %d\n", umid, err);
goto err_rmdir;
if(err){
err = -errno;
printk("Failed to create '%s' - err = %d\n", umid, -errno);
goto err;
}

umid_setup = 1;

create_pid_file();

return 0;

err_rmdir:
rmdir(tmp);
err = 0;
err:
return err;
}

static int __init make_umid_init(void)
{
if(!make_umid())
return 0;

/* If initializing with the given umid failed, then try again with
* a random one.
*/
printk("Failed to initialize umid \"%s\", trying with a random umid\n",
umid);
*umid = '\0';
make_umid();

return 0;
Expand Down

0 comments on commit f27623e

Please sign in to comment.