Changeset 2490 for trunk


Ignore:
Timestamp:
Dec 12, 2005, 5:30:33 AM (20 years ago)
Author:
bird
Message:

We cannot rename open files.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/baselayout/src/pwd_mkdb/pwd_mkdb.c

    r2489 r2490  
    178178         * This lock is necessary when someone runs pwd_mkdb manually, directly
    179179         * on master.passwd, to handle the case where a user might try to
    180          * change his password while pwd_mkdb is running. 
     180         * change his password while pwd_mkdb is running.
    181181         */
    182182        for (;;) {
     
    225225
    226226                /*
    227                  * Do some trouble to check if we should store this users 
    228                  * uid. Don't use getpwnam/getpwuid as that interferes 
     227                 * Do some trouble to check if we should store this users
     228                 * uid. Don't use getpwnam/getpwuid as that interferes
    229229                 * with NIS.
    230230                 */
     
    322322        /* In order to transition this file into a machine-independent
    323323         * form, we have to change the format of entries.  However, since
    324          * older binaries will still expect the old MD format entries, we 
     324         * older binaries will still expect the old MD format entries, we
    325325         * create those as usual and use versioned tags for the new entries.
    326326         */
     
    345345        key.data = (u_char *)tbuf;
    346346        for (cnt = 1; scan(fp, &pwd); ++cnt) {
    347                 if (!is_comment && 
     347                if (!is_comment &&
    348348                    (pwd.pw_name[0] == '+' || pwd.pw_name[0] == '-'))
    349349                        yp_enabled = 1;
     
    354354                        memmove(p, &store, sizeof(store)); \
    355355                        p += sizeof(store);
    356                 if (!is_comment && 
     356                if (!is_comment &&
    357357                    (!username || (strcmp(username, pwd.pw_name) == 0))) {
    358358                        pw_change = pwd.pw_change;
     
    613613         */
    614614        (void)snprintf(buf, sizeof(buf), "%s/%s", prefix, _MASTERPASSWD);
     615#ifdef __EMX__ /* unsafe, but we cannot rename open files. */
     616        if (fclose(fp) == EOF)
     617                error("close fp");
     618#endif
    615619        mv(pname, buf);
    616620
     621#ifndef __EMX__
    617622        /*
    618623         * Close locked password file after rename()
     
    620625        if (fclose(fp) == EOF)
    621626                error("close fp");
     627#endif
    622628
    623629        exit(0);
     
    651657        *p = '\0';
    652658
    653         /* 
     659        /*
    654660         * Ignore comments: ^[ \t]*#
    655661         */
     
    672678}
    673679
    674 void                   
    675 cp(from, to, mode)             
     680void
     681cp(from, to, mode)
    676682        char *from, *to;
    677         mode_t mode;   
    678 {               
     683        mode_t mode;
     684{
    679685        static char buf[MAXBSIZE];
    680686        int from_fd, rcount, to_fd, wcount;
Note: See TracChangeset for help on using the changeset viewer.