openbmc/build/tmp/deploy/sdk/witherspoon-2019-08-08/sysroots/armv6-openbmc-linux-gnueabi/usr/src/debug/base-passwd/3.5.29-r0/base-passwd-3.5.29/update-passwd.c
int put_file_in_place(const char* source, const char* target)
{
    char* uf;
    int ret;

    if (opt_verbose > 2)
        printf("Replacing \"%s\" with \"%s\"\n", target, source);

    asprintf(&uf, "%s%s", target, BACKUP_EXTENSION);

    if (uf == NULL)
    {
        fprintf(stderr, "put_file_in_place: Not enough memory available\n");
        return 0;
    }

    if (!copy_filemodes(target, source))
    {
        free(uf);
        return 0;
    }

    ret = replace_file(target, source, uf);
    free(uf);

    return ret;
}
/* Try to replace a file as safely as possible. If we fail unlink the
 * new copy, since it's useless anyway.
 */
Try to replace a file as safely as possible. If we fail unlink the
new copy, since it's useless anyway.
Try to replace a file as safely as possible . If we fail unlink the new copy since it ' s useless anyway .
int put_file_in_place(const char* source, const char* target)
{
    char* uf;
    int ret;
    if (opt_verbose > 2)
        printf("Replacing \"%s\" with \"%s\"\n", target, source);
    asprintf(&uf, "%s%s", target, BACKUP_EXTENSION);
    if (uf == NULL)
    {
        fprintf(stderr, "put_file_in_place: Not enough memory available\n");
        return 0;
    }
    if (!copy_filemodes(target, source))
    {
        free(uf);
        return 0;
    }
    ret = replace_file(target, source, uf);
    free(uf);
    return ret;
}
int put_file_in_place ( const char * source , const char * target ) { char * uf ; int ret ; if ( opt_verbose > 2 ) printf ( " \" \" \" \" \n " , target , source ) ; asprintf ( & uf , " " , target , BACKUP_EXTENSION ) ; if ( uf == NULL ) { fprintf ( stderr , " \n " ) ; return 0 ; } if ( ! copy_filemodes ( target , source ) ) { free ( uf ) ; return 0 ; } ret = replace_file ( target , source , uf ) ; free ( uf ) ; return ret ; }
Try to replace a file as safely as possible.
Try to replace a file as safely as possible .