| 1 |
/* |
| 2 |
* Copyright (c) 2009, Giampaolo Rodola'. All rights reserved. |
| 3 |
* Use of this source code is governed by a BSD-style license that can be |
| 4 |
* found in the LICENSE file. |
| 5 |
*/ |
| 6 |
|
| 7 |
#include <Python.h> |
| 8 |
#include <stdio.h> |
| 9 |
|
| 10 |
#include "../../arch/all/init.h" |
| 11 |
#include "init.h" |
| 12 |
|
| 13 |
|
| 14 |
void |
| 15 |
convert_kvm_err(const char *syscall, char *errbuf) { |
| 16 |
char fullmsg[8192]; |
| 17 |
|
| 18 |
sprintf(fullmsg, "(originated from %s: %s)", syscall, errbuf); |
| 19 |
if (strstr(errbuf, "Permission denied") != NULL) |
| 20 |
AccessDenied(fullmsg); |
| 21 |
else if (strstr(errbuf, "Operation not permitted") != NULL) |
| 22 |
AccessDenied(fullmsg); |
| 23 |
else |
| 24 |
PyErr_Format(PyExc_RuntimeError, fullmsg); |
| 25 |
} |