~nhandler/ubuntu/lucid/am-utils/merge-from-squeeze

« back to all changes in this revision

Viewing changes to conf/mtab/mtab_file.c

  • Committer: Bazaar Package Importer
  • Author(s): Tim Cutts
  • Date: 2006-11-27 20:37:54 UTC
  • mfrom: (3.1.4 feisty)
  • Revision ID: james.westby@ubuntu.com-20061127203754-i1b3qshs0pfk05pf
Tags: 6.1.5-3
* Moved amq-check-wrap check from config back to postinst (Closes: #400229).
* Fixed an error in the postrm script

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
/*
2
 
 * Copyright (c) 1997-2003 Erez Zadok
 
2
 * Copyright (c) 1997-2006 Erez Zadok
3
3
 * Copyright (c) 1990 Jan-Simon Pendry
4
4
 * Copyright (c) 1990 Imperial College of Science, Technology & Medicine
5
5
 * Copyright (c) 1990 The Regents of the University of California.
36
36
 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
37
37
 * SUCH DAMAGE.
38
38
 *
39
 
 *      %W% (Berkeley) %G%
40
39
 *
41
 
 * $Id: mtab_file.c,v 1.4.2.7 2002/12/27 22:44:51 ezk Exp $
 
40
 * File: am-utils/conf/mtab/mtab_file.c
42
41
 *
43
42
 */
44
43
 
130
129
    endmntent(mfp);
131
130
    mfp = 0;
132
131
  }
133
 
  clock_valid = 0;
134
132
  if (stat(mnttabname, &st_before) < 0) {
135
133
    plog(XLOG_ERROR, "%s: stat: %m", mnttabname);
136
134
    if (errno == ESTALE) {
138
136
      sleep(1);
139
137
      goto again;
140
138
    }
141
 
    return 0;
 
139
    /*
 
140
     * If 'mnttabname' file does not exist give setmntent() a
 
141
     * chance to create it (depending on the mode).
 
142
     * Otherwise, bail out.
 
143
     */
 
144
    else if (errno != ENOENT) {
 
145
      return 0;
 
146
    }
142
147
  }
143
148
 
144
149
eacces:
223
228
   * Release file lock, by closing the file
224
229
   */
225
230
  if (mnt_file) {
 
231
    dlog("unlock_mntlist: releasing");
226
232
    endmntent(mnt_file);
227
233
    mnt_file = 0;
228
234
  }
248
254
  char *cp;
249
255
  char mcp[128];
250
256
 
251
 
  strcpy(mcp, mnttabname);
 
257
  xstrlcpy(mcp, mnttabname, sizeof(mcp));
252
258
  cp = strrchr(mcp, '/');
253
259
  if (cp) {
254
260
    memmove(tmpname, mcp, cp - mcp);
258
264
    tmpname[0] = '.';
259
265
    tmpname[1] = '\0';
260
266
  }
261
 
  strcat(tmpname, "/mtabXXXXXX");
 
267
  xstrlcat(tmpname, "/mtabXXXXXX", sizeof(tmpname));
262
268
  retries = 0;
263
269
enfile1:
264
270
#ifdef HAVE_MKSTEMP