summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJerry Jelinek <jerry.jelinek@joyent.com>2018-08-29 12:14:30 +0000
committerJerry Jelinek <jerry.jelinek@joyent.com>2018-08-29 12:14:30 +0000
commit1ecb6f51f460bf7d1554e2f44731ab4f47ec97e4 (patch)
tree75ec438a234458c7d2084dc18850098c090662a4
parent57b471aeb372d625bad5f7340300b0d5f2d7d7f7 (diff)
parentb982c112ede0da29fbc4152cdc6690d85ddf7207 (diff)
downloadillumos-joyent-1ecb6f51f460bf7d1554e2f44731ab4f47ec97e4.tar.gz
[illumos-gate merge]
commit b982c112ede0da29fbc4152cdc6690d85ddf7207 9775 format: number of sectors is reported one less in case of GPT commit 570479901769888c6a35dcd8d94242a926d0bd87 9699 loader: biosdisk should prefer smaller (safer) sectors value from INT13 commit 322e343b7c538c565d91cb11d00fbe6266834e28 9766 loader: 'mbi' may be used uninitialized commit 522e4551ca5d7b72fe4d4af1ff92521ab19842c7 9764 loader.efi: 'efi_mmap' is used uninitialized commit 69aea4bf4584b2d60ef94da59897ec363890af57 9765 pkgadd has no Z option commit ba93fbafc5df33b7aeb99adb3b9a918afc3e7143 9756 tests: badseg.c error: variable 'rc' set but not used commit fec4bdb512708a1a9c886ed7f84ce353ec85b486 9767 loader: linux.c unused variable 'mem' commit 500cf85b0395b6835818b6248681bbbc27563dc1 9762 Split the custr functions into their own library commit f8e0ecf7cceff807dcd13fe031936e1ff28193e3 9742 libi386: Add workaround for HP BIOS issues Conflicts: usr/src/lib/libcustr/common/llib-lcustr usr/src/lib/libcustr/Makefile.com usr/src/cmd/mailx/Makefile exception_lists/packaging
-rw-r--r--exception_lists/packaging19
-rw-r--r--usr/src/boot/sys/boot/common/multiboot2.c1
-rw-r--r--usr/src/boot/sys/boot/efi/loader/memmap.c1
-rw-r--r--usr/src/boot/sys/boot/i386/libi386/biosdisk.c21
-rw-r--r--usr/src/boot/sys/boot/i386/libi386/linux.c1
-rw-r--r--usr/src/cmd/format/menu_command.c6
-rw-r--r--usr/src/cmd/mailx/Makefile2
-rw-r--r--usr/src/cmd/svr4pkg/hdrs/libinst.h3
-rw-r--r--usr/src/cmd/svr4pkg/hdrs/messages.h15
-rw-r--r--usr/src/cmd/svr4pkg/pkgadd/main.c27
-rw-r--r--usr/src/lib/libcustr/Makefile.com6
-rw-r--r--usr/src/lib/libcustr/common/custr.c2
-rw-r--r--usr/src/lib/libcustr/common/llib-lcustr1
-rw-r--r--usr/src/pkg/manifests/system-library.mf3
-rw-r--r--usr/src/test/os-tests/tests/i386/badseg.c12
15 files changed, 62 insertions, 58 deletions
diff --git a/exception_lists/packaging b/exception_lists/packaging
index 792adaf9df..877d57f389 100644
--- a/exception_lists/packaging
+++ b/exception_lists/packaging
@@ -27,6 +27,7 @@
# Copyright 2018 Nexenta Systems, Inc.
# Copyright 2017 Toomas Soome <tsoome@me.com>
# Copyright 2017 RackTop Systems.
+# Copyright 2018, Joyent, Inc.
#
#
@@ -948,10 +949,10 @@ usr/include/sys/ipmi.h sparc
#
# libsaveargs is private
#
-usr/include/saveargs.h i386
-usr/lib/amd64/libsaveargs.so i386
+usr/include/saveargs.h i386
+usr/lib/amd64/libsaveargs.so i386
usr/lib/amd64/libstandsaveargs.so i386
-usr/lib/amd64/llib-lsaveargs.ln i386
+usr/lib/amd64/llib-lsaveargs.ln i386
#
# libpcidb is private
@@ -1006,3 +1007,15 @@ usr/include/vmmapi.h
usr/platform/i86pc/include/sys/vmm.h
usr/platform/i86pc/include/sys/vmm_impl.h
usr/platform/i86pc/include/sys/vmm_instruction_emul.h
+
+#
+# libcustr is private
+#
+usr/include/libcustr.h
+lib/amd64/libcustr.so i386
+lib/amd64/llib-lcustr.ln i386
+lib/sparcv9/libcustr.so sparc
+lib/sparcv9/llib-lcustr.ln sparc
+lib/libcustr.so
+lib/llib-lcustr
+lib/llib-lcustr.ln
diff --git a/usr/src/boot/sys/boot/common/multiboot2.c b/usr/src/boot/sys/boot/common/multiboot2.c
index 3209c98c06..386bcf2b7a 100644
--- a/usr/src/boot/sys/boot/common/multiboot2.c
+++ b/usr/src/boot/sys/boot/common/multiboot2.c
@@ -803,6 +803,7 @@ multiboot2_exec(struct preloaded_file *fp)
i386_getdev((void **)(&rootdev), NULL, NULL);
#endif
+ mbi = NULL;
error = EINVAL;
if (rootdev == NULL) {
printf("can't determine root device\n");
diff --git a/usr/src/boot/sys/boot/efi/loader/memmap.c b/usr/src/boot/sys/boot/efi/loader/memmap.c
index 50834ab44e..9862e51b5a 100644
--- a/usr/src/boot/sys/boot/efi/loader/memmap.c
+++ b/usr/src/boot/sys/boot/efi/loader/memmap.c
@@ -81,6 +81,7 @@ efi_getsmap(void)
int type = -1;
size = 0;
+ efi_mmap = NULL;
status = BS->GetMemoryMap(&size, efi_mmap, &key, &desc_size, NULL);
efi_mmap = malloc(size);
status = BS->GetMemoryMap(&size, efi_mmap, &key, &desc_size, NULL);
diff --git a/usr/src/boot/sys/boot/i386/libi386/biosdisk.c b/usr/src/boot/sys/boot/i386/libi386/biosdisk.c
index a760a373fa..598cef6814 100644
--- a/usr/src/boot/sys/boot/i386/libi386/biosdisk.c
+++ b/usr/src/boot/sys/boot/i386/libi386/biosdisk.c
@@ -91,6 +91,8 @@ static int nbdinfo = 0;
#define BD(dev) (bdinfo[(dev)->dd.d_unit])
+static void bd_io_workaround(struct disk_devdesc *dev);
+
static int bd_io(struct disk_devdesc *, daddr_t, int, caddr_t, int);
static int bd_int13probe(struct bdinfo *bd);
@@ -267,7 +269,7 @@ bd_int13probe(struct bdinfo *bd)
total = (uint64_t)params.cylinders *
params.heads * params.sectors_per_track;
- if (bd->bd_sectors < total)
+ if (total > 0 && bd->bd_sectors > total)
bd->bd_sectors = total;
ret = 1;
@@ -648,6 +650,14 @@ bd_chs_io(struct disk_devdesc *dev, daddr_t dblk, int blks, caddr_t dest,
return (0);
}
+static void
+bd_io_workaround(struct disk_devdesc *dev)
+{
+ uint8_t buf[8 * 1024];
+
+ bd_edd_io(dev, 0xffffffff, 1, (caddr_t)buf, 0);
+}
+
static int
bd_io(struct disk_devdesc *dev, daddr_t dblk, int blks, caddr_t dest,
int dowrite)
@@ -659,9 +669,18 @@ bd_io(struct disk_devdesc *dev, daddr_t dblk, int blks, caddr_t dest,
return (-1);
/*
+ * Workaround for a problem with some HP ProLiant BIOS failing to work
+ * out the boot disk after installation. hrs and kuriyama discovered
+ * this problem with an HP ProLiant DL320e Gen 8 with a 3TB HDD, and
+ * discovered that an int13h call seems to cause a buffer overrun in
+ * the bios. The problem is alleviated by doing an extra read before
+ * the buggy read. It is not immediately known whether other models
+ * are similarly affected.
* Loop retrying the operation a couple of times. The BIOS
* may also retry.
*/
+ if (dowrite == 0 && dblk >= 0x100000000)
+ bd_io_workaround(dev);
for (retry = 0; retry < 3; retry++) {
/* if retrying, reset the drive */
if (retry > 0) {
diff --git a/usr/src/boot/sys/boot/i386/libi386/linux.c b/usr/src/boot/sys/boot/i386/libi386/linux.c
index d0c8bf68a4..1f2788cb4e 100644
--- a/usr/src/boot/sys/boot/i386/libi386/linux.c
+++ b/usr/src/boot/sys/boot/i386/libi386/linux.c
@@ -408,7 +408,6 @@ static int
linux_loadinitrd(char *filename, uint64_t dest, struct preloaded_file **result)
{
struct preloaded_file *mfp;
- vm_offset_t mem;
if (filename == NULL)
return (EFTYPE);
diff --git a/usr/src/cmd/format/menu_command.c b/usr/src/cmd/format/menu_command.c
index aff9d39ce8..bc441b0e86 100644
--- a/usr/src/cmd/format/menu_command.c
+++ b/usr/src/cmd/format/menu_command.c
@@ -1554,9 +1554,9 @@ c_label()
*/
if (expert_mode) {
#if defined(_SUNOS_VTOC_8)
- int i;
+ int i;
#endif
- int choice;
+ int choice;
u_ioparam_t ioparam;
struct extvtoc vtoc;
struct dk_label label;
@@ -2086,7 +2086,7 @@ c_verify_efi()
fmt_print("\n");
fmt_print("bytes/sector = %d\n", cur_blksz);
- fmt_print("sectors = %llu\n", cur_parts->etoc->efi_last_lba);
+ fmt_print("sectors = %llu\n", cur_parts->etoc->efi_last_lba + 1);
fmt_print("accessible sectors = %llu\n",
cur_parts->etoc->efi_last_u_lba);
diff --git a/usr/src/cmd/mailx/Makefile b/usr/src/cmd/mailx/Makefile
index a690b95815..6afe955bf2 100644
--- a/usr/src/cmd/mailx/Makefile
+++ b/usr/src/cmd/mailx/Makefile
@@ -68,7 +68,7 @@ CERRWARN += -_gcc=-Wno-parentheses
CERRWARN += -_gcc=-Wno-uninitialized
CERRWARN += -_gcc=-Wno-unused-variable
CERRWARN += -_gcc=-Wno-clobbered
-LINTFLAGS= -hb
+LINTFLAGS= -hb
LDLIBS += -lmail -lcustr
LDFLAGS += $(MAPFILE.NGB:%=-M%)
diff --git a/usr/src/cmd/svr4pkg/hdrs/libinst.h b/usr/src/cmd/svr4pkg/hdrs/libinst.h
index deef500c2b..836bb13886 100644
--- a/usr/src/cmd/svr4pkg/hdrs/libinst.h
+++ b/usr/src/cmd/svr4pkg/hdrs/libinst.h
@@ -20,7 +20,7 @@
*/
/*
- * Copyright (c) 2017 Peter Tribble.
+ * Copyright (c) 2018 Peter Tribble.
*/
/*
@@ -65,7 +65,6 @@ typedef unsigned long CAF_T;
#define CAF_IN_GLOBAL_ZONE 0x00000001 /* in global zone */
#define CAF_SCOPE_GLOBAL 0x00000002 /* -G specified */
-#define CAF_SCOPE_NONGLOBAL 0x00000004 /* -Z specified */
/* path to the request file in the package directory */
diff --git a/usr/src/cmd/svr4pkg/hdrs/messages.h b/usr/src/cmd/svr4pkg/hdrs/messages.h
index d20a1d6df5..a7f2de9637 100644
--- a/usr/src/cmd/svr4pkg/hdrs/messages.h
+++ b/usr/src/cmd/svr4pkg/hdrs/messages.h
@@ -20,7 +20,7 @@
*/
/*
- * Copyright (c) 2017 Peter Tribble.
+ * Copyright (c) 2018 Peter Tribble.
*/
/*
@@ -412,7 +412,6 @@ extern "C" {
#define ERR_ALLZONES_AND_IN_LZ gettext("The package <%s> may only be installed by the global zone administrator")
#define ERR_ALLZONES_AND_IN_LZ_PKGRM gettext("The package <%s> may only be removed by the global zone administrator")
#define ERR_ALLZONES_AND_THISZONE gettext("The package <%s> has <%s> = true and <%s> = true: the package may set either parameter to true, but may not set both parameters to true. NOTE: if the package contains a request script, it is treated as though it has <SUNW_PKG_THISZONE> = true")
-#define ERR_ALLZONES_AND_Z_USED gettext("The -Z option (extend packages installed in the global zone to all non-global zones) may not be used with the package <%s> which may only be installed in all zones by the global zone administrator")
#define ERR_ARG gettext("URL <%s> is not valid")
#define ERR_BADULIMIT gettext("cannot process invalid ULIMIT value of <%s>.")
#define ERR_BADUSER gettext("unable to find user <%s> or <%s>.")
@@ -485,12 +484,7 @@ extern "C" {
#define ERR_INVALID_O_OPTION gettext("option <%s> passed to -O is not recognized: option ignored")
#define ERR_IN_GZ_AND_ALLZONES_AND_INSTALLED gettext("The package <%s> is currently installed on\nthe system in the global zone only. When this package was last installed\nthe -G option was used (install package in the global zone only). The new\ninstance of this package to be installed may only be installed in all zones.\nBefore you can install the latest version of this package, you must first\nremove all instances of this package from the global zone (via pkgrm).")
#define ERR_IN_GZ_AND_NOT_INSTALLED gettext("WARNING: The package <%s> is marked as being installed in the\nglobal zone only. The package is NOT installed on the system. This condition\nis not possible. The file <%s> must be edited\nand the line for this package removed.")
-
-#ifdef Z_OPTION_IS_SUPPORTED
-#define ERR_IN_GZ_AND_NO_G_USED gettext("The package <%s> is currently installed on the\nsystem in the global zone. To install the new instance of this package in the\nglobal zone only, you must specify the -G option. To install the new instance\nof this package in all zones you must first run pkgadd on the current package\nwith the -Z option so that the existing instance of this package is installed\nin all zones first. You may optionally remove the existing instance of this\npackage from the global zone first (via pkgrm) and then install the new\ninstance of this package in all zones.")
-#else
#define ERR_IN_GZ_AND_NO_G_USED gettext("The package <%s> is currently installed on the system in the\nglobal zone. To install the new instance of this package in the global\nzone only, you must specify the -G option. To install the new instance\nof this package in all zones you must first remove the existing instance\nof this package from the global zone first (via pkgrm) and then install\nthe new instance of this package in all zones.")
-#endif
#define ERR_LINK gettext("unable to link <%s> to <%s>: %s")
#define ERR_LIVE_CONTINUE_NOT_SUPPORTED gettext("live continue mode is not supported")
@@ -521,7 +515,6 @@ extern "C" {
#define ERR_NOREQUEST gettext("package does not contain an interactive request script")
#define ERR_NORESP gettext("response file <%s> must not exist")
#define ERR_NOTABLE gettext("unable to open %s table <%s>: %s")
-#define ERR_NOT_IN_GZ_AND_Z_USED gettext("The package <%s> is not currently installed\nin the global zone only; you may not specify the -Z option to install the\npackage in all non-global zones until the package is first install in the\nglobal zone only. You may optionally install the package without the -Z option\nto install the package in all zones.")
#define ERR_NOT_ROOT gettext("You must be \"root\" for %s to execute properly.")
#define ERR_NOW_ALLZONES_AND_HOLLOW gettext("The package <%s> has <%s> = false and <%s> = true: a hollow package must also be set to install in all zones")
#define ERR_NO_LIVE_MODE gettext("live continue mode is not supported")
@@ -630,7 +623,6 @@ extern "C" {
#define ERR_STREAMDIR gettext("unable to make temporary directory to unpack datastream: %s")
#define ERR_STREAM_UNAVAILABLE gettext("unable to open stream <%s> for package <%s>: %s")
#define ERR_SYSINFO gettext("unable to process installed package information, errno=%d")
-#define ERR_THISZONE_AND_Z_USED gettext("The package <%s> has <%s> = true: the -Z option may not be used to extend this type of package to all non-global zones")
#define ERR_TMPFILE gettext("unable to establish temporary file")
#define ERR_TMPFILE_CHK gettext("unable to create temporary checkinstall script")
#define ERR_TMPRESP gettext("unable to create temporary response file")
@@ -642,12 +634,7 @@ extern "C" {
#define ERR_UNPACK_FMKDIR gettext("unable to create temporary package area <%s>: %s")
#define ERR_UNSUCC gettext("(A previous attempt may have been unsuccessful.)")
-#ifdef Z_OPTION_IS_SUPPORTED
-#define ERR_USAGE_PKGADD_GLOBALZONE gettext("usage:\n\t%s [-nv] [-d device] [[-M] -R host_path] [-V fs_file] [-a admin_file] [-r response] [-G|-Z] [-Y category[,category ...] | pkg [pkg ...]]\n\t%s -s dir [-d device] [-G|-Z] [-Y category[,category ...] | pkg [pkg ...]]\n")
-#else
#define ERR_USAGE_PKGADD_GLOBALZONE gettext("usage:\n\t%s [-nv] [-d device] [[-M] -R host_path] [-V fs_file] [-a admin_file] [-r response] [-G] [-Y category[,category ...] | pkg [pkg ...]]\n\t%s -s dir [-d device] [-G] [-Y category[,category ...] | pkg [pkg ...]]\n")
-#endif
-
#define ERR_USAGE_PKGADD_NONGLOBALZONE gettext("usage:\n\t%s [-nv] [-d device] [[-M] -R host_path] [-V fs_file] [-a admin_file] [-r response] [-Y category[,category ...] | pkg [pkg ...]]\n\t%s -s dir [-d device] [-Y category[,category ...] | pkg [pkg ...]]\n")
#define ERR_USAGE_PKGASK gettext("usage: %s -r response [-d device] [-R host_path] [-Y category[,category ...]] | [pkg [pkg ...]]\n")
#define ERR_USAGE_PKGINSTALL gettext("usage:\n\tpkginstall [-o] [-n] [-d device] [-m mountpt [-f fstype]] [-v] [[-M] -R host_path] [-V fs_file] [-b bindir] [-a admin_file] [-r resp_file] [-N calling_prog] directory pkginst\n")
diff --git a/usr/src/cmd/svr4pkg/pkgadd/main.c b/usr/src/cmd/svr4pkg/pkgadd/main.c
index c2f0125d55..4f05b28318 100644
--- a/usr/src/cmd/svr4pkg/pkgadd/main.c
+++ b/usr/src/cmd/svr4pkg/pkgadd/main.c
@@ -20,7 +20,7 @@
*/
/*
- * Copyright (c) 2017 Peter Tribble.
+ * Copyright (c) 2018 Peter Tribble.
*/
/*
@@ -349,7 +349,7 @@ main(int argc, char **argv)
*/
while ((c = getopt(argc, argv,
- "?Aa:b:B:Cc:D:d:GhIMnO:R:r:Ss:tV:vY:zZ")) != EOF) {
+ "?Aa:b:B:Cc:D:d:GhIMnO:R:r:Ss:tV:vY:z")) != EOF) {
switch (c) {
/*
@@ -2303,7 +2303,6 @@ usage(void)
* under which the package is to be installed:
* CAF_IN_GLOBAL_ZONE - in global zone
* CAF_SCOPE_GLOBAL - -G specified
- * CAF_SCOPE_NONGLOBAL - -Z specified
* Returns: boolean_t
* B_TRUE - the package can be installed
* B_FALSE - the package can not be installed
@@ -2537,13 +2536,6 @@ check_applicability(char *a_packageDir, char *a_pkgInst, char *a_rootPath,
return (B_FALSE);
}
- /* pkg ALLZONES=true && -Z specified */
-
- if (all_zones && (a_flags & CAF_SCOPE_NONGLOBAL)) {
- progerr(ERR_ALLZONES_AND_Z_USED, a_pkgInst);
- return (B_FALSE);
- }
-
/* pkg ALLZONES=true & not running in global zone (#2/#3) */
if (all_zones && (!(a_flags & CAF_IN_GLOBAL_ZONE))) {
@@ -2580,21 +2572,6 @@ check_applicability(char *a_packageDir, char *a_pkgInst, char *a_rootPath,
return (B_FALSE);
}
- /* pkg "NOT in gz only" & -Z specified */
-
- if ((!in_gz_only) && (a_flags & CAF_SCOPE_NONGLOBAL)) {
- progerr(ERR_NOT_IN_GZ_AND_Z_USED, a_pkgInst);
- return (B_FALSE);
- }
-
- /* pkg "this zone" && -Z specified */
-
- if (this_zone && (a_flags & CAF_SCOPE_NONGLOBAL)) {
- progerr(ERR_THISZONE_AND_Z_USED, PKG_THISZONE_VARIABLE,
- a_pkgInst);
- return (B_FALSE);
- }
-
/*
* If this package is marked 'this zone only', then mark the package
* as "add to this zone only". This is referenced by the various
diff --git a/usr/src/lib/libcustr/Makefile.com b/usr/src/lib/libcustr/Makefile.com
index 747026da89..cbd61ece4b 100644
--- a/usr/src/lib/libcustr/Makefile.com
+++ b/usr/src/lib/libcustr/Makefile.com
@@ -19,8 +19,9 @@ OBJECTS = custr.o
include $(SRC)/lib/Makefile.lib
-# Things out of /sbin like dladm require custr, so it should go into /lib so
-# they can work in case /usr is split
+# On some illumos distributions (e.g. SmartOS), utilities in /sbin require
+# custr. Place libcustr in /lib so such distros can work even if /usr is
+# split onto its own filesystem.
include $(SRC)/lib/Makefile.rootfs
LIBS = $(DYNLIB) $(LINTLIB)
@@ -28,6 +29,7 @@ LDLIBS += -lc
CPPFLAGS += -D__EXTENSIONS__
SRCDIR = ../common
+$(LINTLIB) := SRCS = $(SRCDIR)/$(LINTSRC)
.KEEP_STATE:
diff --git a/usr/src/lib/libcustr/common/custr.c b/usr/src/lib/libcustr/common/custr.c
index 429fedf8e9..5c5b0e370a 100644
--- a/usr/src/lib/libcustr/common/custr.c
+++ b/usr/src/lib/libcustr/common/custr.c
@@ -14,7 +14,7 @@
*/
/*
- * Copyright 2016 Joyent, Inc.
+ * Copyright 2018 Joyent, Inc.
*/
#include <stdlib.h>
diff --git a/usr/src/lib/libcustr/common/llib-lcustr b/usr/src/lib/libcustr/common/llib-lcustr
index 5c08550594..61a1885c85 100644
--- a/usr/src/lib/libcustr/common/llib-lcustr
+++ b/usr/src/lib/libcustr/common/llib-lcustr
@@ -16,4 +16,5 @@
/*LINTLIBRARY*/
/*PROTOLIB1*/
+#include <sys/debug.h>
#include <libcustr.h>
diff --git a/usr/src/pkg/manifests/system-library.mf b/usr/src/pkg/manifests/system-library.mf
index c8cdd6f53f..94ae932b59 100644
--- a/usr/src/pkg/manifests/system-library.mf
+++ b/usr/src/pkg/manifests/system-library.mf
@@ -25,6 +25,7 @@
# Copyright (c) 2013 Gary Mills
# Copyright 2017 Nexenta Systems, Inc.
# Copyright 2017 RackTop Systems.
+# Copyright 2018, Joyent, Inc.
#
<include system-library.man3.inc>
@@ -193,6 +194,7 @@ file path=lib/$(ARCH64)/libcontract.so.1
file path=lib/$(ARCH64)/libcryptoutil.so.1
file path=lib/$(ARCH64)/libctf.so.1
file path=lib/$(ARCH64)/libcurses.so.1
+file path=lib/$(ARCH64)/libcustr.so.1
file path=lib/$(ARCH64)/libdevice.so.1
file path=lib/$(ARCH64)/libdevid.so.1
file path=lib/$(ARCH64)/libdevinfo.so.1
@@ -270,6 +272,7 @@ file path=lib/libcontract.so.1
file path=lib/libcryptoutil.so.1
file path=lib/libctf.so.1
file path=lib/libcurses.so.1
+file path=lib/libcustr.so.1
file path=lib/libdevice.so.1
file path=lib/libdevid.so.1
file path=lib/libdevinfo.so.1
diff --git a/usr/src/test/os-tests/tests/i386/badseg.c b/usr/src/test/os-tests/tests/i386/badseg.c
index 6bf4e0260f..7e5e8b8a32 100644
--- a/usr/src/test/os-tests/tests/i386/badseg.c
+++ b/usr/src/test/os-tests/tests/i386/badseg.c
@@ -57,17 +57,19 @@ static void
resetseg(uint_t seg)
{
ucontext_t ucp;
- int done = 0;
+ volatile int done = 0;
int rc = getcontext(&ucp);
if (done) {
- rc = getcontext(&ucp);
+ (void) getcontext(&ucp);
return;
}
- done = 1;
- ucp.uc_mcontext.gregs[seg] = selector;
- setcontext(&ucp);
+ if (rc == 0) {
+ done = 1;
+ ucp.uc_mcontext.gregs[seg] = selector;
+ setcontext(&ucp);
+ }
abort();
}