Start coding un_attach
This commit is contained in:
parent
ddbfa25b0f
commit
d4177f9895
28
lib/attach.c
28
lib/attach.c
@ -57,7 +57,7 @@ int attach(faddr noden, char *ofile, int mode, char flavor, int fdn)
|
|||||||
/*
|
/*
|
||||||
* Check if we attach a file with the same name
|
* Check if we attach a file with the same name
|
||||||
*/
|
*/
|
||||||
if ((fdn) && (un_attach(noden, flavor, ofile) == FALSE)) {
|
if ((fdn) && (un_attach(noden, ofile) == FALSE)) {
|
||||||
WriteError("attach: can't un_attach %s, %s", ofile, strerror(rc));
|
WriteError("attach: can't un_attach %s, %s", ofile, strerror(rc));
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
@ -137,7 +137,7 @@ int attach(faddr noden, char *ofile, int mode, char flavor, int fdn)
|
|||||||
/*
|
/*
|
||||||
* Remove a file from the flofile, also search for a .tic file.
|
* Remove a file from the flofile, also search for a .tic file.
|
||||||
*/
|
*/
|
||||||
int un_attach(faddr node, char flavor, char *filename)
|
int un_attach(faddr node, char *filename)
|
||||||
{
|
{
|
||||||
char *flofile, *buf;
|
char *flofile, *buf;
|
||||||
FILE *fp;
|
FILE *fp;
|
||||||
@ -146,15 +146,35 @@ int un_attach(faddr node, char flavor, char *filename)
|
|||||||
|
|
||||||
buf = calloc(PATH_MAX+3, sizeof(char));
|
buf = calloc(PATH_MAX+3, sizeof(char));
|
||||||
flofile = calloc(PATH_MAX, sizeof(char));
|
flofile = calloc(PATH_MAX, sizeof(char));
|
||||||
sprintf(flofile, "%s", floname(&noden, flavor));
|
|
||||||
|
|
||||||
|
sprintf(flofile, "%s", floname(&node, 'h'));
|
||||||
|
if ((fp = fopen(flofile, "r+"))) {
|
||||||
|
while (fgets(buf, sizeof(buf -1), fp)) {
|
||||||
|
Striplf(buf);
|
||||||
|
Syslog('p', "hlo: \"%s\"", buf);
|
||||||
|
|
||||||
|
}
|
||||||
|
fclose(fp);
|
||||||
|
}
|
||||||
|
|
||||||
|
sprintf(flofile, "%s", floname(&node, 'c'));
|
||||||
|
if ((fp = fopen(flofile, "r+"))) {
|
||||||
|
while (fgets(buf, sizeof(buf -1), fp)) {
|
||||||
|
Striplf(buf);
|
||||||
|
Syslog('p', "clo: \"%s\"", buf);
|
||||||
|
|
||||||
|
}
|
||||||
|
fclose(fp);
|
||||||
|
}
|
||||||
|
|
||||||
|
sprintf(flofile, "%s", floname(&node, 'f'));
|
||||||
if ((fp = fopen(flofile, "r+"))) {
|
if ((fp = fopen(flofile, "r+"))) {
|
||||||
while (fgets(buf, sizeof(buf -1), fp)) {
|
while (fgets(buf, sizeof(buf -1), fp)) {
|
||||||
Striplf(buf);
|
Striplf(buf);
|
||||||
Syslog('p', "flo: \"%s\"", buf);
|
Syslog('p', "flo: \"%s\"", buf);
|
||||||
|
|
||||||
}
|
}
|
||||||
fclose(flofile);
|
fclose(fp);
|
||||||
}
|
}
|
||||||
|
|
||||||
free(flofile);
|
free(flofile);
|
||||||
|
@ -2115,7 +2115,7 @@ int le_int(int);
|
|||||||
* From attach.c
|
* From attach.c
|
||||||
*/
|
*/
|
||||||
int attach(faddr, char *, int, char, int);
|
int attach(faddr, char *, int, char, int);
|
||||||
int un_attach(faddr, char, char *);
|
int un_attach(faddr, char *);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user