Path: utzoo!news-server.csri.toronto.edu!rpi!zaphod.mps.ohio-state.edu!pacific.mps.ohio-state.edu!linac,att!emory!wuarchive!waikato.ac.nz!comp.vuw.ac.nz!mark From: mark@comp.vuw.ac.nz (Mark Davies) Newsgroups: comp.sys.hp Subject: Re: setmntent problem Keywords: setmntent, mnttab, AMD Message-ID: <1991Mar18.210700.3043@comp.vuw.ac.nz> Date: 18 Mar 91 21:07:00 GMT References: <7760@skye.cs.ed.ac.uk> Sender: news@comp.vuw.ac.nz (News Admin) Organization: Dept. of Comp. Sci., Victoria Uni. of Wellington, New Zealand. Lines: 46 Nntp-Posting-Host: the-taj.comp.vuw.ac.nz Originator: mark@the-taj.comp.vuw.ac.nz In article <7760@skye.cs.ed.ac.uk>, jtb@cs.edinburgh.ac.uk (Jo Blishen) writes: |> I am experiencing an intermittent problem when running AMD 5.2 on a |> HP9000/375 under HP-UX version 7.0. AMD reports the following errors: |> setmntent ("/etc/mnttab","a") permission denied |> couldn't find how to unmount /a/server/whichever/partition... |> Has anyone else seen this? Has anyone else fixed this already? Is there |> any known problem with "setmntent" - it seems to me that it shouldn't |> be giving "permission denied" messages to a program running as root |> trying to append to /etc/mnttab? Yes I've seen this. HP's setmntent() is seriously broken. The mnttab routines do not correctly lock the mnttab file. I would have to scratch around for the details as it was 6 months ago I was playing with this but I think the following patch to amd got around the problem: *** mtab_file.c~ Sun Jun 24 09:17:07 1990 --- mtab_file.c Wed Sep 26 22:57:01 1990 *************** *** 207,213 **** plog(XLOG_ERROR, "Couldn't write %s: %m", mtab); endmntent(mfp); } else { ! if (errno == ENFILE && retries < NFILE_RETRIES) { sleep(1); goto enfile; } --- 207,215 ---- plog(XLOG_ERROR, "Couldn't write %s: %m", mtab); endmntent(mfp); } else { ! if (errno == EACCES || errno == EAGAIN) { ! goto enfile; ! } else if (errno == ENFILE && retries < NFILE_RETRIES) { sleep(1); goto enfile; } You will also probably get problems with "df" failing on occassion (if its trying to read the mnttab while amd is updating it). This is the same problem and we fixed it here by replacing df with our own copy. cheers mark