bug-hurd
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH] Check for a return value in netfs_make_peropen before using it i


From: Flavio Cruz
Subject: [PATCH] Check for a return value in netfs_make_peropen before using it in netfs_make_protid.
Date: Sun, 7 Feb 2016 09:19:38 -0500
User-agent: Mutt/1.5.24 (2015-08-30)

* libnetfs/trans-callback.c: Add check.
---
 libnetfs/trans-callback.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/libnetfs/trans-callback.c b/libnetfs/trans-callback.c
index f4f0c62..9ebe11c 100644
--- a/libnetfs/trans-callback.c
+++ b/libnetfs/trans-callback.c
@@ -58,14 +58,18 @@ _netfs_translator_callback2_fn (void *cookie1, void 
*cookie2, int flags,
   struct protid *cred;
   struct node *node = cookie1;
   struct iouser *user;
+  struct peropen *po;
 
   err = iohelp_create_simple_iouser (&user, node->nn_stat.st_uid,
                                   node->nn_stat.st_gid);
   if (err)
     return err;
 
-  cred = netfs_make_protid (netfs_make_peropen (node, flags, cookie2),
-                           user);
+  po = netfs_make_peropen (node, flags, cookie2);
+  if (! po)
+    return ENOMEM;
+
+  cred = netfs_make_protid (po, user);
   if (cred)
     {
       *underlying = ports_get_right (cred);
-- 
2.6.4




reply via email to

[Prev in Thread] Current Thread [Next in Thread]