From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-oi1-f172.google.com ([209.85.167.172]) by ewsd; Sat Oct 24 19:53:04 -0400 2020 Received: by mail-oi1-f172.google.com with SMTP id u127so6657577oib.6 for <9front@9front.org>; Sat, 24 Oct 2020 16:52:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:message-id:to:subject:date:in-reply-to:mime-version :content-transfer-encoding; bh=qrHh4/n7QmLueD5RbNc9WUG7uiXvjE+6mipzKYjFGpw=; b=tkviPPTa3bCLH4u5fExooaD8Zfn5XkTRcG+pDSCmSpPfcW55dxOpOHVphwKknLeN4r pRwV7kAl0kWPBrfAaJNHc5r2QU5tbY00oireAwws5GQFWFuE0VfEMBChSU/Imqpj3H+A 805kpZS/CmGP4CZvWn+j2vQGzAi1P8UkirTqRR8MRgDcwcA9QipYs4mkyBvl6z2iU+bL pw0hQjF/2ag+HyC+T0WgmTVIT+AOWCKCHCY8kOOpvW7t16ambSAl2RreqwcAlZDrogYj emUtMvts0UKicvfLfU2fkfoGXDDPm8nnG80IVN1eEc7ZtxAQHys951QiRKWf8XRywtcf 69aQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:message-id:to:subject:date:in-reply-to :mime-version:content-transfer-encoding; bh=qrHh4/n7QmLueD5RbNc9WUG7uiXvjE+6mipzKYjFGpw=; b=VMA19VPeaLczrr9QBk7ayhzjMfrQeSt251a0piiQ7vh6oilT4Z1D6RHqsRTy4NbtP7 NbzUySqRR+B7ZwnGDkrSBABPe5ehpbU+vOF9PDMvCND+BpKWnOF7pBjJXFBe1jG8jQ4X ennpvE0yYDftNUMG6OSHFhYDPeMbC9QtjjJy4yWBbhi0eMwPg42VUPJxO06HhlWsAs2N i6SVYxqY9DwoK1tKatJ9gH2JJ3z4emC1YfwdZN5VmOmB/Ldz0PYS6ijw06EPAvX5pEQT V1JxRmfw8WkUCGmKj/7COtPPSshIO7m2vAl1Q2aeXQ5cIUhRcTeRwLAnT2S8zrrSNW6V Q4yA== X-Gm-Message-State: AOAM532NXLpbGGZ/AcElIxmMbxj2VK1jOQuHQj5HRXfs7DZ/WDQydHZE 4bENyOFmFhD0tSLk+fiOlkB5CrlR57GMuA== X-Google-Smtp-Source: ABdhPJwRly6aH7hAMMA6pbfLiQXJ0C1HMvDZwxdoS1QReP1APfcZGClBwTwynUJjYp1ucScyKhBflA== X-Received: by 2002:aca:5f41:: with SMTP id t62mr7322100oib.162.1603583579095; Sat, 24 Oct 2020 16:52:59 -0700 (PDT) Return-Path: Received: from think9term.covert9net (67-198-106-217.dyn.grandenetworks.net. [67.198.106.217]) by smtp.gmail.com with ESMTPSA id w189sm1755827oif.5.2020.10.24.16.52.58 for <9front@9front.org> (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Sat, 24 Oct 2020 16:52:58 -0700 (PDT) From: covertusername967@gmail.com X-Google-Original-From: glenda@gmail.com Message-ID: To: 9front@9front.org Subject: Re: [9front] libmp and error handling Date: Sat, 24 Oct 2020 18:52:53 -0500 In-Reply-To: <1795470027CF8F4349F3EB3E6D25A7EF@eigenstate.org> MIME-Version: 1.0 Content-Type: text/plain; charset="US-ASCII" Content-Transfer-Encoding: 7bit List-ID: <9front.9front.org> List-Help: X-Glyph: ➈ X-Bullshit: injection proxy YAML callback shader-aware engine > This is still likely to require quite a bit of change in libmp; if > it's currently calling sysfatal, then it's very likely full of > things like: > > x = a(); > y = b() > return mpadd(x, y); > > which means that if b() errors, then x is leaked. So, I tried changing libmp itself. It rapidly became a hairy mess of return checking, and making the library do more allocation just to preserve the original function arguments. Instead, here's a patch to fix the manpage: diff -r 5a6b0e6ac3b2 sys/man/2/mp --- a/sys/man/2/mp Sun Oct 25 00:49:29 2020 +0200 +++ b/sys/man/2/mp Sat Oct 24 18:51:53 2020 -0500 @@ -287,8 +287,8 @@ .I mpnew and .IR mpcopy , -will return -.B nil +will call sysfatal (see +.IR perror (2)) if the allocation fails. .PP Input and result parameters may point to the same