Commit Graph

38 Commits

Author SHA1 Message Date
Peter Jones 64e26162eb calloc: Make sure we always have an overflow-checking calloc() available
This tries to make sure that everywhere in this source tree, we always have
an appropriate version of calloc() (i.e. grub_calloc(), xcalloc(), etc.)
available, and that they all safely check for overflow and return NULL when
it would occur.

Signed-off-by: Peter Jones <pjones@redhat.com>
Reviewed-by: Daniel Kiper <daniel.kiper@oracle.com>
2020-07-29 16:55:47 +02:00
Vladimir Serbinenko d900dfa985 kern/emu/misc.c: Don't include config-util.h when running as GRUB_BUILD
Signed-off-by: Vladimir Serbinenko <phcoder@google.com>
2019-03-25 15:10:15 +01:00
Pete Batard 4e0f8f66e3 Add missing va_end() to xasprintf() in grub-emu. 2016-08-13 16:36:01 +03:00
Michael Chang 64e2d139fe Restore terminal settings on grub-emu exit. 2016-01-22 11:05:32 +01:00
Vladimir Serbinenko 3f430a0126 Move file loading functions to grub-emu.
So that we can use it in grub-emu as well as utils.
2016-01-05 21:10:27 +01:00
Andrey Borzenkov 989af02582 remove unused error.h from kern/emu/misc.c
Fixes compilation on mingw32, where include is apparently missing.
2013-12-28 09:04:10 +04:00
Vladimir 'phcoder' Serbinenko f4e0adc0f9 Remove leftover references to some of the system headers. 2013-10-15 17:59:54 +02:00
Vladimir 'phcoder' Serbinenko 2112fb3fef * grub-core/kern/emu/misc.c (fsync) [__MINGW32__]: Move to ...
* grub-core/osdep/windows/hostdisk.c (fsync) [__MINGW32__]: ... here.
2013-10-08 20:05:24 +02:00
Vladimir 'phcoder' Serbinenko c2e6f70589 * grub-core/kern/emu/misc.c (grub_get_rtc): Remove (it's a leftover). 2013-10-08 19:53:57 +02:00
Vladimir 'phcoder' Serbinenko a5b0365ab2 * grub-core/kern/emu/misc.c (canonicalize_file_name): Move to ...
* grub-core/kern/emu/hostdisk_*.c (canonicalize_file_name): ... here.
2013-10-08 17:04:46 +02:00
Vladimir 'phcoder' Serbinenko 47345010a4 Add AROS hostdisk and getroot routines. 2013-10-04 02:35:03 +02:00
Vladimir 'phcoder' Serbinenko 7b780018f5 Handle grub-pe2elf and grub-mkfont for cases when build != host.
* Makefile.am (build-grub-mkfont): Don't include gnulib.
	(build-grub-gen-asciih): Likewise.
	(build-grub-gen-widthspec): Likewise.
	* Makefile.util.def (grub-pe2elf): Remove.
	* config.h.in [GRUB_BUILD]: Use build rather than host constants.
	* configure.ac: Separate tests for build.
	Move ./build-grub-pe2elf to grub-core.
	Fix typo.
	* grub-core/Makefile.am (build-grub-pe2elf): New target.
	* grub-core/kern/emu/misc.c (xasprintf): Don't compile if GRUB_BUILD is
	defined.
	* include/grub/types.h [GRUB_BUILD]: Use build rather than host
	constants.
	* util/grub-mkfont.c [GRUB_BUILD]: Simplify not to rely on argp.
	* util/grub-pe2elf.c: Simplify not to rely on getopt.
	* util/misc.c (program_name) [GRUB_BUILD]: Define to static string.
2013-08-22 17:00:59 +02:00
Vladimir 'phcoder' Serbinenko 984cfd8a79 * grub-core/kern/emu/hostdisk.c (grub_util_get_fd_size): Adapt for
mingw32 as well based on grub_util_get_disk_size.
	* util/misc.c (grub_util_get_disk_size): Removed. all users switched to
	grub_util_get_fd_size.
	(sync): Removed.
	(fsync): Moved to ...
	* grub-core/kern/emu/misc.c (fsync): ... here.
2013-08-22 16:50:12 +02:00
Vladimir 'phcoder' Serbinenko f0b94ded6d * grub-core/kern/emu/misc.c (grub_device_mapper_supported): Move from
here ...
	* grub-core/kern/emu/hostdisk.c (grub_device_mapper_supported): ... to
	here.
2013-08-14 17:55:15 +02:00
Vladimir 'phcoder' Serbinenko 7c9d0c39af Fix handling of build-time grub-bin2h and grub-mkfont when doing
full Canadian cross. Tested with build=x86_64, host=arm,
	target=ppc-ieee1275.
2013-08-14 10:56:55 +02:00
Vladimir 'phcoder' Serbinenko 0f7e980b29 Redirect xasprintf to grub_xvasprintf rather than having #ifdef's
for vasprintf presence.
2013-05-10 20:57:32 +02:00
Vladimir 'phcoder' Serbinenko 67093bc0ed Another round of string clarification and adding TRANSLATORS comments. 2012-02-26 17:28:05 +01:00
Vladimir 'phcoder' Serbinenko 7e94d044ad * grub-core/disk/geli.c (grub_md_sha256_real): Respect format security.
(grub_md_sha512_real): Likewise.
	(grub_util_get_geli_uuid): Likewise.
	* grub-core/kern/emu/hostdisk.c (grub_util_get_fd_sectors): Likewise.
	(grub_util_biosdisk_open): Fix format specification.
	Respect format security.
	* grub-core/kern/emu/misc.c (xmalloc): Respect format security.
	(xrealloc): Likewise.
	(xasprintf): Likewise.
2012-02-10 14:01:53 +01:00
Vladimir 'phcoder' Serbinenko 6e0632e28c * grub-core/commands/acpihalt.c: Gettextized.
* grub-core/commands/cacheinfo.c: Likewise.
	* grub-core/commands/cmp.c: Likewise.
	* grub-core/commands/efi/loadbios.c: Likewise.
	* grub-core/commands/gptsync.c: Likewise.
	* grub-core/commands/ieee1275/suspend.c: Likewise.
	* grub-core/commands/legacycfg.c: Likewise.
	* grub-core/commands/memrw.c: Likewise.
	* grub-core/commands/minicmd.c: Likewise.
	* grub-core/commands/parttool.c: Likewise.
	* grub-core/commands/time.c: Likewise.
	* grub-core/commands/videoinfo.c: Likewise.
	* grub-core/disk/geli.c: Likewise.
	* grub-core/disk/i386/pc/biosdisk.c: Likewise.
	* grub-core/disk/luks.c: Likewise.
	* grub-core/disk/lvm.c: Likewise.
	* grub-core/font/font_cmd.c: Likewise.
	* grub-core/fs/zfs/zfscrypt.c: Likewise.
	* grub-core/fs/zfs/zfsinfo.c: Likewise.
	* grub-core/gfxmenu/view.c: Likewise.
	* grub-core/kern/emu/hostdisk.c: Likewise.
	* grub-core/kern/emu/main.c: Likewise.
	* grub-core/kern/emu/misc.c: Likewise.
	* grub-core/kern/emu/mm.c: Likewise.
	* grub-core/kern/mips/arc/init.c: Likewise.
	* grub-core/kern/mips/loongson/init.c: Likewise.
	* grub-core/kern/partition.c: Likewise.
	* grub-core/lib/i386/halt.c: Likewise.
	* grub-core/lib/mips/arc/reboot.c: Likewise.
	* grub-core/lib/mips/loongson/reboot.c: Likewise.
	* grub-core/loader/i386/pc/chainloader.c: Likewise.
	* grub-core/loader/i386/xnu.c: Likewise.
	* grub-core/loader/multiboot.c: Likewise.
	* grub-core/net/bootp.c: Likewise.
	* grub-core/net/net.c: Likewise.
	* grub-core/normal/term.c: Likewise.
	* grub-core/partmap/bsdlabel.c: Likewise.
	* grub-core/parttool/msdospart.c: Likewise.
	* grub-core/term/gfxterm.c: Likewise.
	* grub-core/term/terminfo.c: Likewise.
	* grub-core/video/i386/pc/vbe.c: Likewise.
	* util/grub-menulst2cfg.c: Likewise.
	* util/grub-mkdevicemap.c: Likewise.
	* util/grub-mklayout.c: Likewise.
	* util/grub-mkrelpath.c: Likewise.
	* util/grub-script-check.c: Likewise.
	* util/ieee1275/grub-ofpathname.c: Likewise.
	* util/resolve.c: Likewise.
2011-11-11 21:44:56 +01:00
Mario Limonciello c05de0329b * grub-core/kern/emu/misc.c (canonicalize_file_name) [__MINGW32__]: Use
_fullpath.
2011-09-29 10:36:55 +02:00
Vladimir 'phcoder' Serbinenko 2e418de646 Remove getroot.c from core on emu platform.
* grub-core/Makefile.core.def (kernel): Remove kern/emu/getroot.c and
	kern/emu/raid.c.
	* grub-core/kern/emu/main.c (main): Don't try to guess root device. It's
	useless.
	* grub-core/kern/emu/misc.c (get_win32_path): Moved from here...
	* util/getroot.c (get_win32_path): ... here.
	* grub-core/kern/emu/misc.c (fini_libzfs): Moved from here...
	* util/getroot.c (fini_libzfs): ... here.
	* grub-core/kern/emu/misc.c (grub_get_libzfs_handle): Moved from here...
	* util/getroot.c (grub_get_libzfs_handle): ... here.
	* grub-core/kern/emu/misc.c (grub_find_zpool_from_dir):
	Moved from here...
	* util/getroot.c (grub_find_zpool_from_dir): ... here.
	* grub-core/kern/emu/misc.c
	(grub_make_system_path_relative_to_its_root): Moved from here...
	* util/getroot.c (grub_make_system_path_relative_to_its_root): ... here.
	* grub-core/kern/emu/getroot.c: Moved from here ...
	* util/getroot.c: ... here. All users updated.
	* grub-core/kern/emu/raid.c: Moved from here ...
	* util/raid.c: ... here. All users updated.
2011-07-08 13:33:12 +02:00
Vladimir 'phcoder' Serbinenko 228cfb40bf support bind and subvolume mount 2010-12-02 14:26:46 +01:00
Vladimir 'phcoder' Serbinenko 4f6a2e2175 * grub-core/kern/emu/misc.c
(grub_make_system_path_relative_to_its_root)
	[HAVE_LIBZFS && HAVE_LIBNVPAIR]: Fix mountpoint return on ZFS.
2010-10-23 20:39:08 +02:00
Vladimir 'phcoder' Serbinenko 5c81f8b349 * grub-core/kern/emu/misc.c
(grub_make_system_path_relative_to_its_root): Revert r2882.
2010-10-23 20:34:50 +02:00
Robert Millan 1eb01cd276 2010-10-16 Robert Millan <rmh@gnu.org>
* grub-core/kern/emu/misc.c
	(grub_make_system_path_relative_to_its_root): Fix premature return
	when processing non-root ZFS filesystems.
2010-10-16 02:30:14 +02:00
Vladimir 'phcoder' Serbinenko 899d8af498 * grub-core/kern/emu/misc.c (asprintf): Use vsnprintf instead of
vsprintf.
2010-09-20 19:14:29 +02:00
Vladimir 'phcoder' Serbinenko 742f9232e3 Split config.h for util and core.
* acinclude.m4 (HAVE_ASM_USCORE): Transformed into a variable.
	(ADDR32): Likewise.
	(DATA32): Likewise.
	(BSS_START_SYMBOL): Likewise.
	(END_SYMBOL): Likewise.
	(NEED_ENABLE_EXECUTE_STACK): Likewise. All users updated.
	(grub_I386_ASM_ABSOLUTE_WITHOUT_ASTERISK): Removed.
	* config.h.in: New file.
	* configure.ac: Use config-util.h as config define file.
	Rename MACHINE into GRUB_MACHINE. All users updated.
	(NEED_REGISTER_FRAME_INFO): Transformed into a variable. All users
	updated.
	(NESTED_FUNC_ATTR): Likewise.
	Substitue new variables.
	(COND_HAVE_ASM_USCORE): New conditional.
	* grub-core/Makefile.am (ASM_PREFIX): New variable.
	(kernel_syms.lst): Use ASM_PREFIX.
	* grub-core/kern/emu/console.c: Include config-util.h.
	* grub-core/kern/emu/misc.c: Likewise.
	* grub-core/kern/emu/mm.c: Likewise.
	* include/grub/emu/misc.h: Likewise.
	* include/grub/libgcc.h: Likewise.
2010-09-19 22:22:43 +02:00
Vladimir 'phcoder' Serbinenko 39feb0e8f9 * grub-core/term/efi/console.c (efi_codes): Fix GRUB_TERM_KEY_*
constants usage.
	* grub-core/kern/emu/console.c (grub_ncurses_getkey):
	Fix GRUB_TERM_KEY_* constants usage.
	* grub-core/kern/emu/misc.c (asprintf): Fix vasprintf usage.
2010-09-19 22:09:05 +02:00
Robert Millan c38fe9f48e 2010-09-10 Robert Millan <rmh@gnu.org>
Solaris support in grub_find_zpool_from_dir().  Thanks
	Seth Goldberg for referring to getextmntent() facility.
	
	* configure.ac: Check for getextmntent(), `sys/mnttab.h' and
	`sys/mkdev.h'.
	* grub-core/kern/emu/misc.c [HAVE_SYS_MNTTAB_H]: Include
	`<sys/mnttab.h>'.
	[HAVE_SYS_MKDEV_H]: Include `<sys/mkdev.h>'.
	[HAVE_GETEXTMNTENT] (grub_find_zpool_from_dir): Add getextmntent()
	method for finding zpool name.
2010-09-10 14:32:28 +02:00
Robert Millan fb90b54648 2010-09-10 Robert Millan <rmh@gnu.org>
* configure.ac: Check for `struct statfs.f_fstypename' and
	`struct statfs.f_mntfromname'.
	
	* grub-core/kern/emu/misc.c (grub_find_zpool_from_dir): Conditionalize
	kFreeBSD-specific code.
2010-09-10 14:02:54 +02:00
BVK Chaitanya 0c8b61d8e4 automake based build system for grub 2010-08-23 23:26:24 +05:30
BVK Chaitanya 16c7cb32c8 merge with mainline 2010-08-19 16:54:00 +05:30
BVK Chaitanya 297f0c2b6e merge with mainline 2010-07-13 00:43:28 +05:30
BVK Chaitanya fe16b84557 pull-in emu-lite 2010-06-01 09:12:01 +05:30
BVK Chaitanya 692d7c2855 pull-in emu-lite branch 2010-05-26 17:49:05 +05:30
BVK Chaitanya ac49c9200a merge with emu-lite again 2010-05-06 13:13:26 +05:30
BVK Chaitanya 16321bf9ca pull-in emu-lite branch 2010-05-06 12:55:47 +05:30
BVK Chaitanya 8c41176882 automake commit without merge history 2010-05-06 11:34:04 +05:30