… | |
… | |
18 | * You should have received a copy of the GNU General Public License |
18 | * You should have received a copy of the GNU General Public License |
19 | * along with this program; if not, write to the Free Software |
19 | * along with this program; if not, write to the Free Software |
20 | * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. |
20 | * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. |
21 | *----------------------------------------------------------------------*/ |
21 | *----------------------------------------------------------------------*/ |
22 | |
22 | |
23 | #include <cstdlib> |
23 | #include <stdlib.h> |
24 | #include <cstring> |
24 | #include <string.h> |
25 | #include <cstdio> |
25 | #include <stdio.h> |
26 | |
26 | |
27 | #include <inttypes.h> |
27 | #include <inttypes.h> |
28 | #include <unistd.h> |
28 | #include <unistd.h> |
29 | #include <errno.h> |
29 | #include <errno.h> |
30 | #include <sys/stat.h> |
30 | #include <sys/stat.h> |
… | |
… | |
91 | return false; |
91 | return false; |
92 | |
92 | |
93 | if (len) |
93 | if (len) |
94 | *len = l; |
94 | *len = l; |
95 | |
95 | |
96 | data = new char[l + 1]; |
96 | data = (char *)malloc (l + 1); |
|
|
97 | |
|
|
98 | if (!data) |
|
|
99 | return false; |
97 | |
100 | |
98 | if (read (fd, data, l) != l) |
101 | if (read (fd, data, l) != l) |
99 | return false; |
102 | return false; |
100 | |
103 | |
101 | data[l] = 0; |
104 | data[l] = 0; |