[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[hurd] 52/53: Fix handling of console readlink errors
From: |
Samuel Thibault |
Subject: |
[hurd] 52/53: Fix handling of console readlink errors |
Date: |
Thu, 20 Mar 2014 02:23:53 +0000 |
This is an automated email from the git hooks/post-receive script.
sthibault pushed a commit to branch upstream
in repository hurd.
commit 2294f2fdffcf724cc28653976b8029351e41fd77
Author: Samuel Thibault <address@hidden>
Date: Sun Mar 16 20:04:11 2014 +0100
Fix handling of console readlink errors
* console-client/trans.c (netfs_attempt_lookup): Look for errors returned by
`readlink' before allocating a node.
(netfs_attempt_readlink): Look for errors returned by `readlink'.
---
console-client/trans.c | 30 ++++++++++++++++++++++--------
1 file changed, 22 insertions(+), 8 deletions(-)
diff --git a/console-client/trans.c b/console-client/trans.c
index 00c5407..d65161c 100644
--- a/console-client/trans.c
+++ b/console-client/trans.c
@@ -269,7 +269,20 @@ netfs_attempt_lookup (struct iouser *user, struct node
*dir,
{
if (cn->node == NULL)
{
- struct netnode *nn = calloc (1, sizeof *nn);
+ struct netnode *nn;
+ ssize_t size = 0;
+
+ if (cn->readlink)
+ {
+ size = cn->readlink (user, NULL, NULL);
+ if (size < 0)
+ {
+ err = -size;
+ goto out;
+ }
+ }
+
+ nn = calloc (1, sizeof *nn);
if (nn == NULL)
{
err = ENOMEM;
@@ -283,15 +296,10 @@ netfs_attempt_lookup (struct iouser *user, struct node
*dir,
(*node)->nn_stat.st_mode = (netfs_root_node->nn_stat.st_mode &
~S_IFMT & ~S_ITRANS);
(*node)->nn_stat.st_ino = 5;
if (cn->readlink)
- {
(*node)->nn_stat.st_mode |= S_IFLNK;
- (*node)->nn_stat.st_size = cn->readlink (user, NULL, NULL);
- }
else
- {
(*node)->nn_stat.st_mode |= S_IFCHR;
- (*node)->nn_stat.st_size = 0;
- }
+ (*node)->nn_stat.st_size = size;
cn->node = *node;
goto out;
}
@@ -508,7 +516,13 @@ netfs_attempt_readlink (struct iouser *user, struct node
*np,
char *buf)
{
if (np->nn->node && np->nn->node->readlink)
- return np->nn->node->readlink (user, np, buf);
+ {
+ error_t err = np->nn->node->readlink (user, np, buf);
+ if (err < 0)
+ return -err;
+ else
+ return 0;
+ }
return EOPNOTSUPP;
}
--
Alioth's /usr/local/bin/git-commit-notice on
/srv/git.debian.org/git/pkg-hurd/hurd.git
- [hurd] 47/53: mach-defpager: silently ignore requests to page to active partition, (continued)
- [hurd] 47/53: mach-defpager: silently ignore requests to page to active partition, Samuel Thibault, 2014/03/19
- [hurd] 46/53: mach-defpager: fix type of size arguments, Samuel Thibault, 2014/03/19
- [hurd] 35/53: pfinet: fix receiver lookups in iioctl-ops.c, Samuel Thibault, 2014/03/19
- [hurd] 49/53: Merge branch 'master' of git.savannah.gnu.org:/srv/git/hurd/hurd, Samuel Thibault, 2014/03/19
- [hurd] 30/53: libnetfs: fix receiver lookups in fsys server functions, Samuel Thibault, 2014/03/19
- [hurd] 50/53: Fix crash on accessing vcs without a console being active, Samuel Thibault, 2014/03/19
- [hurd] 37/53: term: fix receiver lookups in the term server functions, Samuel Thibault, 2014/03/19
- [hurd] 33/53: libtrivfs: improve the mig mutator functions, Samuel Thibault, 2014/03/19
- [hurd] 51/53: Fix vcs_readlink propagating error returned by console_current_id, Samuel Thibault, 2014/03/19
- [hurd] 53/53: Merge remote-tracking branch 'upstream/master' into upstream, Samuel Thibault, 2014/03/19
- [hurd] 52/53: Fix handling of console readlink errors,
Samuel Thibault <=
- [hurd] 04/53: isofs: add bz2 to OTHERLIBS, Samuel Thibault, 2014/03/19
- [hurd] 11/53: Merge branch 'master' of git.savannah.gnu.org:/srv/git/hurd/hurd, Samuel Thibault, 2014/03/19
- [hurd] 09/53: libdiskfs: fix typo, Samuel Thibault, 2014/03/19
- [hurd] 13/53: Add missing copyright notice, Samuel Thibault, 2014/03/19
- [hurd] 42/53: mach-defpager: add and use synchronized_printf for dprintf, Samuel Thibault, 2014/03/19
- [hurd] 05/53: fatfs: add bz2 to OTHERLIBS, Samuel Thibault, 2014/03/19
- [hurd] 07/53: Merge branch 'master' of git.savannah.gnu.org:/srv/git/hurd/hurd, Samuel Thibault, 2014/03/19
- [hurd] 31/53: libdiskfs: fix receiver lookups in fsys server functions, Samuel Thibault, 2014/03/19
- [hurd] 43/53: mach-defpager: fix error handling in S_default_pager_object_set_size, Samuel Thibault, 2014/03/19
- [hurd] 03/53: Merge branch 'master' of git.savannah.gnu.org:/srv/git/hurd/hurd, Samuel Thibault, 2014/03/19