Date: Wed, 12 Dec 2018 23:02:21 +0100 From: Matthias Petermann <matthias@petermann-it.de> To: freebsd-questions@freebsd.org Subject: Re: /sbin/dump: instant exit in case of disk full (instead of prompting for next volume) Message-ID: <6f5bba74-431c-29ce-1459-c8f5a3053fec@petermann-it.de> In-Reply-To: <20181207092858.101f83be.freebsd@edvax.de> References: <6116a4e5-34d1-3823-dd5e-28c784083cf2@petermann-it.de> <20181207092858.101f83be.freebsd@edvax.de>
next in thread | previous in thread | raw e-mail | index | archive | help
Hi, On 07.12.18 09:28, Polytropon wrote: > However, you could modify the dump program to exit with a > specific error code if "disk is full" should be reached. My first take on that was that I implemented some kind of auto-reply switch and modified the query() method in optr.c. Anyway - what I found there was already the solution for my root problem that I did not want dump to wait for user input while started from cron: int query(const char *question, int defaultreply) { char replybuffer[64]; int back, errcount; FILE *mytty; if ((mytty = fopen(_PATH_TTY, "r")) == NULL) quit("fopen on %s fails: %s\n", _PATH_TTY, strerror(errno)); I'm sorry that I did not do this kind of test earlier. If there is no controlling terminal, all attempts of dump to interact with the user will lead to exit with status code 3. This is enough for me at the moment, but I still am in favor of having an explicit return code in case the disk is full. When I find some time I will look how this could be implemented properly. Kind regards, Matthias -- Matthias Petermann <matthias@petermann-it.de> | www.petermann-it.de
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?6f5bba74-431c-29ce-1459-c8f5a3053fec>