git.annexia.org
/
libguestfs.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
tests: Put test-tool and comment into own section.
[libguestfs.git]
/
daemon
/
mknod.c
diff --git
a/daemon/mknod.c
b/daemon/mknod.c
index
46a1839
..
d5b8467
100644
(file)
--- a/
daemon/mknod.c
+++ b/
daemon/mknod.c
@@
-13,7
+13,7
@@
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
- * Foundation, Inc.,
675 Mass Ave, Cambridge, MA 02139,
USA.
+ * Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301
USA.
*/
#include <config.h>
*/
#include <config.h>
@@
-26,7
+26,7
@@
#include <sys/types.h>
#include <sys/stat.h>
#include <sys/types.h>
#include <sys/stat.h>
-#include "
../src/
guestfs_protocol.h"
+#include "guestfs_protocol.h"
#include "daemon.h"
#include "actions.h"
#include "optgroups.h"
#include "daemon.h"
#include "actions.h"
#include "optgroups.h"
@@
-51,12
+51,17
@@
do_mknod (int mode, int devmajor, int devminor, const char *path)
#ifdef HAVE_MKNOD
int r;
#ifdef HAVE_MKNOD
int r;
+ if (mode < 0) {
+ reply_with_error ("%s: mode is negative", path);
+ return -1;
+ }
+
CHROOT_IN;
r = mknod (path, mode, makedev (devmajor, devminor));
CHROOT_OUT;
if (r == -1) {
CHROOT_IN;
r = mknod (path, mode, makedev (devmajor, devminor));
CHROOT_OUT;
if (r == -1) {
- reply_with_perror ("
mknod:
%s", path);
+ reply_with_perror ("%s", path);
return -1;
}
return -1;
}