diff options
author | Marcus Brinkmann <marcus@gnu.org> | 2001-09-09 17:32:03 +0000 |
---|---|---|
committer | Marcus Brinkmann <marcus@gnu.org> | 2001-09-09 17:32:03 +0000 |
commit | c33495ca9cf1bb12ac5bc3263458fdf3331c1f89 (patch) | |
tree | f5575875f366c78f59c4d59f5ea24c80e77a5cc0 /libnetfs/dir-lookup.c | |
parent | cd07eece45992a52e4c6c9ad1d7ae47b0f82fbe9 (diff) |
2001-08-31 Marcus Brinkmann <marcus@gnu.org>
* file-get-translator.c (netfs_S_file_get_translator): If
asprintf() fails, set ERR to errno.
* dir-lookup.c (netfs_S_dir_lookup): Catch if asprintf() fails and
return ENOMEM. If netfs_make_protid() fails, set ERROR to errno,
not ENOMEM. Do this before freeing USER.
* dir-mkfile.c (netfs_S_dir_mkfile): If netfs_make_protid() fails,
set ERROR to errno and free USER.
* file-exec.c (netfs_S_file_exec): Likewise.
Reported by Igor Khavkine <i_khavki@alcor.concordia.ca>.
Diffstat (limited to 'libnetfs/dir-lookup.c')
-rw-r--r-- | libnetfs/dir-lookup.c | 23 |
1 files changed, 16 insertions, 7 deletions
diff --git a/libnetfs/dir-lookup.c b/libnetfs/dir-lookup.c index 6911f5ae..bf81a17b 100644 --- a/libnetfs/dir-lookup.c +++ b/libnetfs/dir-lookup.c @@ -209,17 +209,19 @@ netfs_S_dir_lookup (struct protid *diruser, { case S_IFCHR: case S_IFBLK: - asprintf (argz, "%s%c%d%c%d", - (S_ISCHR (np->nn_stat.st_mode) - ? _HURD_CHRDEV : _HURD_BLKDEV), - 0, major (np->nn_stat.st_rdev), - 0, minor (np->nn_stat.st_rdev)); + if (asprintf (argz, "%s%c%d%c%d", + (S_ISCHR (np->nn_stat.st_mode) + ? _HURD_CHRDEV : _HURD_BLKDEV), + 0, major (np->nn_stat.st_rdev), + 0, minor (np->nn_stat.st_rdev)) < 0) + return ENOMEM; *argz_len = strlen (*argz) + 1; *argz_len += strlen (*argz + *argz_len) + 1; *argz_len += strlen (*argz + *argz_len) + 1; break; case S_IFIFO: - asprintf (argz, "%s", _HURD_FIFO); + if (asprintf (argz, "%s", _HURD_FIFO) < 0) + return ENOMEM; *argz_len = strlen (*argz) + 1; break; default: @@ -242,8 +244,8 @@ netfs_S_dir_lookup (struct protid *diruser, user); if (! newpi) { + error = errno; iohelp_free_iouser (user); - error = ENOMEM; } } @@ -381,6 +383,13 @@ netfs_S_dir_lookup (struct protid *diruser, newpi = netfs_make_protid (netfs_make_peropen (np, flags, diruser->po), user); + if (! newpi) + { + iohelp_free_iouser (user); + error = errno; + goto out; + } + *retry_port = ports_get_right (newpi); ports_port_deref (newpi); |