* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the
- * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
+ * License along with this library; if not, see <http://www.gnu.org/licenses/>.
*
* Author: Matthias Clasen
*/
g_printerr ("Data truncated\n");
g_bytes_unref (bytes);
}
- else
- {
- g_printerr ("Can't find resource path %s\n", path);
- }
}
/* Elf functions {{{1 */
elf = elf_begin (*fd, ELF_C_READ, NULL);
if (elf == NULL)
- return NULL;
+ {
+ g_close (*fd, NULL);
+ *fd = -1;
+ return NULL;
+ }
if (elf_kind (elf) != ELF_K_ELF)
- return NULL;
+ {
+ g_close (*fd, NULL);
+ *fd = -1;
+ return NULL;
+ }
return elf;
}
if (contents != MAP_FAILED)
{
GBytes *bytes;
+ GError *error = NULL;
bytes = g_bytes_new_static (contents + page_offset, shdr->sh_size);
- resource = g_resource_new_from_data (bytes, NULL);
+ resource = g_resource_new_from_data (bytes, &error);
g_bytes_unref (bytes);
+ if (error)
+ {
+ g_printerr ("%s\n", error->message);
+ g_error_free (error);
+ }
}
else
{
extract_resource (resource, d->path);
g_resource_unref (resource);
- return FALSE;
+ if (d->section)
+ return FALSE;
+
+ return TRUE;
}
static void
GResource *resource;
#ifdef HAVE_LIBELF
-
Elf *elf;
int fd;