Bug Summary

File:obj-scan-build/usermux/../../usermux/node.c
Location:line 91, column 2
Description:Value stored to 'flags' is never read

Annotated Source Code

1/* General fs node functions
2
3 Copyright (C) 1997, 1999, 2007 Free Software Foundation, Inc.
4
5 Written by Miles Bader <miles@gnu.ai.mit.edu>
6
7 This file is part of the GNU Hurd.
8
9 The GNU Hurd is free software; you can redistribute it and/or
10 modify it under the terms of the GNU General Public License as
11 published by the Free Software Foundation; either version 2, or (at
12 your option) any later version.
13
14 The GNU Hurd is distributed in the hope that it will be useful, but
15 WITHOUT ANY WARRANTY; without even the implied warranty of
16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17 General Public License for more details.
18
19 You should have received a copy of the GNU General Public License
20 along with this program; if not, write to the Free Software
21 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA. */
22
23#include <fcntl.h>
24
25#include "usermux.h"
26
27/* Node maintenance. */
28
29/* Node NP is all done; free all its associated storage. */
30void
31netfs_node_norefs (struct node *node)
32{
33 if (node->nn->name)
34 /* Remove our name's pointer to us; the name itself will eventually be
35 freed by another party. */
36 node->nn->name->node = 0;
37 if (node->nn->trans_len > 0)
38 free (node->nn->trans);
39 free (node->nn);
40 free (node);
41}
42
43/* Attempt to create a file named NAME in DIR for USER with MODE. Set *NODE
44 to the new node upon return. On any error, clear *NODE. *NODE should be
45 locked on success; no matter what, unlock DIR before returning. */
46error_t
47netfs_attempt_create_file (struct iouser *user, struct node *dir,
48 char *name, mode_t mode, struct node **node)
49{
50 *node = 0;
51 pthread_mutex_unlock (&dir->lock);
52 return EOPNOTSUPP((0x10 << 26) | ((45) & 0x3fff));
53}
54
55/* Node NODE is being opened by USER, with FLAGS. NEWNODE is nonzero if we
56 just created this node. Return an error if we should not permit the open
57 to complete because of a permission restriction. */
58error_t
59netfs_check_open_permissions (struct iouser *user, struct node *node,
60 int flags, int newnode)
61{
62 error_t err = 0;
63 if (flags & O_READ0x0001)
64 err = fshelp_access (&node->nn_stat, S_IREAD00400, user);
65 if (!err && (flags & O_WRITE0x0002))
66 err = fshelp_access (&node->nn_stat, S_IWRITE00200, user);
67 if (!err && (flags & O_EXEC0x0004))
68 err = fshelp_access (&node->nn_stat, S_IEXEC00100, user);
69 return err;
70}
71
72/* This should attempt a utimes call for the user specified by CRED on node
73 NODE, to change the atime to ATIME and the mtime to MTIME. */
74error_t
75netfs_attempt_utimes (struct iouser *cred, struct node *node,
76 struct timespec *atime, struct timespec *mtime)
77{
78 error_t err = fshelp_isowner (&node->nn_stat, cred);
79 int flags = TOUCH_CTIME0x4;
80
81 if (! err)
82 {
83 if (mtime)
84 node->nn_stat.st_mtim = *mtime;
85 else
86 flags |= TOUCH_MTIME0x2;
87
88 if (atime)
89 node->nn_stat.st_atim = *atime;
90 else
91 flags |= TOUCH_ATIME0x1;
Value stored to 'flags' is never read
92
93 fshelp_touch (&node->nn_stat, TOUCH_CTIME0x4, usermux_maptime);
94 }
95 return err;
96}
97
98/* Return the valid access types (bitwise OR of O_READ, O_WRITE, and O_EXEC)
99 in *TYPES for file NODE and user CRED. */
100error_t
101netfs_report_access (struct iouser *cred, struct node *node, int *types)
102{
103 *types = 0;
104 if (fshelp_access (&node->nn_stat, S_IREAD00400, cred) == 0)
105 *types |= O_READ0x0001;
106 if (fshelp_access (&node->nn_stat, S_IWRITE00200, cred) == 0)
107 *types |= O_WRITE0x0002;
108 if (fshelp_access (&node->nn_stat, S_IEXEC00100, cred) == 0)
109 *types |= O_EXEC0x0004;
110 return 0;
111}
112
113/* Trivial definitions. */
114
115/* Make sure that NP->nn_stat is filled with current information. CRED
116 identifies the user responsible for the operation. */
117error_t
118netfs_validate_stat (struct node *node, struct iouser *cred)
119{
120 return 0;
121}
122
123/* This should sync the file NODE completely to disk, for the user CRED. If
124 WAIT is set, return only after sync is completely finished. */
125error_t
126netfs_attempt_sync (struct iouser *cred, struct node *node, int wait)
127{
128 return 0;
129}