Archive-Unzip-Burst
view release on metacpan or search on metacpan
unzip-6.0/aosvs/aosvs.c view on Meta::CPAN
ucsize + strlen(G.filename);
slinkentry *slnk_entry;
if (slnk_entrysize < ucsize) {
Info(slide, 0x201, ((char *)slide,
"warning: symbolic link (%s) failed: mem alloc overflow\n",
FnFilter1(G.filename)));
fclose(G.outfile);
return;
}
if ((slnk_entry = (slinkentry *)malloc(slnk_entrysize)) == NULL) {
Info(slide, 0x201, ((char *)slide,
"warning: symbolic link (%s) failed: no mem\n",
FnFilter1(G.filename)));
fclose(G.outfile);
return;
}
slnk_entry->next = NULL;
slnk_entry->targetlen = ucsize;
slnk_entry->attriblen = 0; /* don't set attributes for symlinks */
slnk_entry->target = slnk_entry->buf;
slnk_entry->fname = slnk_entry->target + ucsize + 1;
strcpy(slnk_entry->fname, G.filename);
/* move back to the start of the file to re-read the "link data" */
rewind(G.outfile);
if (fread(slnk_entry->target, 1, ucsize, G.outfile) != ucsize)
{
Info(slide, 0x201, ((char *)slide,
"warning: symbolic link (%s) failed\n",
FnFilter1(G.filename)));
free(slnk_entry);
fclose(G.outfile);
return;
}
fclose(G.outfile); /* close "link" file for good... */
slnk_entry->target[ucsize] = '\0';
if (QCOND2)
Info(slide, 0, ((char *)slide, "-> %s ",
FnFilter1(slnk_entry->target)));
/* add this symlink record to the list of deferred symlinks */
if (G.slink_last != NULL)
G.slink_last->next = slnk_entry;
else
G.slink_head = slnk_entry;
G.slink_last = slnk_entry;
return;
}
#endif /* SYMLINKS */
fclose(G.outfile);
/*---------------------------------------------------------------------------
Change the file permissions from default ones to those stored in the
zipfile.
---------------------------------------------------------------------------*/
#ifndef NO_CHMOD
if (chmod(G.filename, 0xffff & G.pInfo->file_attr))
perror("chmod (file attributes) error");
#endif
/*---------------------------------------------------------------------------
AOS/VS only allows setting file times at creation but has its own permis-
sions scheme which is better invoked here if the necessary information
was in fact stored. In theory, we should look through an entire series
of extra fields that might exist for the same file, but we're not going
to bother. If we set up other types of extra fields, or if we run into
other environments that add their own stuff to existing entries in ZIP
files, we'll have to. NOTE: already copied extra-field stuff into
zzextrafld structure when file was created.
---------------------------------------------------------------------------*/
if (G.extra_field != NULL) {
if (!memcmp(ZEXTRA_HEADID, zzextrafld.extra_header_id,
sizeof(zzextrafld.extra_header_id)) &&
!memcmp(ZEXTRA_SENTINEL, zzextrafld.extra_sentinel,
sizeof(zzextrafld.extra_sentinel)) &&
zzextrafld.fstat_packet.norm_fstat_packet.styp_type != $FLNK)
/* (AOS/VS links don't have ACLs) */
{
/* vs_path was set (in this case) when we created the file */
if (sys_sacl(vs_path, zzextrafld.aclbuf)) {
Info(slide, 0x201, ((char *)slide,
"error: cannot set ACL for %s\n", FnFilter1(G.filename)));
perror("sys_sacl()");
}
}
}
} /* end function close_outfile() */
#ifndef SFX
/************************/
/* Function version() */
/************************/
void version(__G)
__GDEF
{
#if (defined(__GNUC__) && defined(NX_CURRENT_COMPILER_RELEASE))
char cc_namebuf[40];
char cc_versbuf[40];
#else
#if (defined(CRAY) && defined(_RELEASE))
char cc_versbuf[40];
#endif
#endif
#if ((defined(CRAY) || defined(cray)) && defined(_UNICOS))
char os_namebuf[40];
#else
#if defined(__NetBSD__)
char os_namebuf[40];
#endif
#endif
/* Pyramid, NeXT have problems with huge macro expansion, too: no Info() */
( run in 0.971 second using v1.01-cache-2.11-cpan-a49fcb8fa48 )