Commit ccae31fd authored by Bernhard Link's avatar Bernhard Link

move isregularfile to filecntl, remove unneeded copyfile.h headers

parent b9f87d62
......@@ -30,8 +30,8 @@
#include "ignore.h"
#include "strlist.h"
#include "checksums.h"
#include "copyfile.h"
#include "names.h"
#include "filecntl.h"
#include "dirs.h"
#include "chunks.h"
#include "reference.h"
......
......@@ -35,16 +35,6 @@
extern int verbose;
void copyfile_delete(const char *fullfilename) {
int err;
err = unlink(fullfilename);
if( err != 0 ) {
fprintf(stderr,"error while unlinking %s: %m\n",fullfilename);
}
}
retvalue copy(const char *fullfilename,const char *origfile,/*@null@*/const char *md5expected,/*@null@*//*@out@*/char **calculatedmd5sum) {
char *md5sum;
retvalue r;
......@@ -155,23 +145,3 @@ retvalue copyfile_hardlink(const char *mirrordir, const char *filekey, const cha
free(fullfilename);
return RET_OK;
}
retvalue regularfileexists(const char *fullfilename) {
struct stat s;
int i;
i = stat(fullfilename,&s);
if( i == 0 && S_ISREG(s.st_mode) )
return RET_OK;
else
return RET_ERROR_MISSING;
}
bool isregularfile(const char *fullfilename) {
struct stat s;
int i;
assert(fullfilename != NULL);
i = stat(fullfilename,&s);
return i == 0 && S_ISREG(s.st_mode);
}
......@@ -6,7 +6,5 @@ retvalue copyfile_copy(const char *mirrordir,const char *filekey,const char *ori
retvalue copyfile_move(const char *mirrordir,const char *filekey,const char *origfile,/*@null@*/const char *md5expected,/*@out@*/char **md5sum);
retvalue copyfile_hardlink(const char *mirrordir, const char *filekey, const char *tempfile, const char *md5sum);
void copyfile_delete(const char *fullfilename);
retvalue regularfileexists(const char *fullfilename);
bool isregularfile(const char *fullfilename);
#endif
......@@ -35,10 +35,10 @@
#include "names.h"
#include "database.h"
#include "dirs.h"
#include "filecntl.h"
#include "files.h"
#include "reference.h"
#include "tracking.h"
#include "copyfile.h"
#include "dpkgversions.h"
#include "distribution.h"
#include "database_p.h"
......
......@@ -33,7 +33,6 @@
#include "dirs.h"
#include "names.h"
#include "release.h"
#include "copyfile.h"
#include "tracking.h"
#include "override.h"
#include "log.h"
......
......@@ -34,7 +34,6 @@
#include "chunks.h"
#include "database.h"
#include "exports.h"
#include "copyfile.h"
#include "configparser.h"
#include "filecntl.h"
......
......@@ -9,10 +9,12 @@
#include <limits.h>
#include <stdint.h>
#include <stdbool.h>
#include <stdlib.h>
#include <unistd.h>
#include <fcntl.h>
#include <stdio.h>
#include <assert.h>
#include "filecntl.h"
......@@ -51,3 +53,12 @@ void deletefile(const char *fullfilename) {
fprintf(stderr,"error while unlinking %s: %m\n",fullfilename);
}
}
bool isregularfile(const char *fullfilename) {
struct stat s;
int i;
assert(fullfilename != NULL);
i = stat(fullfilename,&s);
return i == 0 && S_ISREG(s.st_mode);
}
......@@ -6,5 +6,6 @@ void closefrom(int);
#endif
void markcloseonexec(int);
void deletefile(const char *);
bool isregularfile(const char *);
#endif
......@@ -476,7 +476,7 @@ retvalue files_include(struct database *database,const char *sourcefilename,cons
return r;
if( RET_IS_OK(r) ) {
if( delete >= D_MOVE ) {
copyfile_delete(sourcefilename);
deletefile(sourcefilename);
}
if( calculatedmd5sum != NULL ) {
char *n = strdup(md5sum);
......@@ -516,7 +516,7 @@ retvalue files_include(struct database *database,const char *sourcefilename,cons
} else {
// The file has the md5sum we know already.
if( delete >= D_MOVE ) {
copyfile_delete(sourcefilename);
deletefile(sourcefilename);
}
if( calculatedmd5sum != NULL )
*calculatedmd5sum = md5indatabase;
......
......@@ -36,7 +36,6 @@
#include "names.h"
#include "checksums.h"
#include "chunks.h"
#include "copyfile.h"
#include "target.h"
#include "signature.h"
#include "binaries.h"
......@@ -1750,7 +1749,7 @@ retvalue process_incoming(const char *basedir,const char *confdir,const char *ov
}
if( verbose >= 3 )
printf("deleting '%s'...\n", fullfilename);
copyfile_delete(fullfilename);
deletefile(fullfilename);
free(fullfilename);
}
incoming_free(i);
......
......@@ -36,6 +36,7 @@
#include "error.h"
#include "mprintf.h"
#include "strlist.h"
#include "filecntl.h"
#include "chunks.h"
#include "sha1.h"
#include "md5.h"
......
......@@ -28,11 +28,11 @@
#include <signal.h>
#include <time.h>
#include "error.h"
#include "filecntl.h"
#include "mprintf.h"
#include "strlist.h"
#include "names.h"
#include "dirs.h"
#include "copyfile.h"
#include "md5sum.h"
#include "chunks.h"
#include "chunkedit.h"
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment