[darwinbuild-changes] [480] branches/PR-6688645/darwinup
source_changes at macosforge.org
source_changes at macosforge.org
Wed Mar 18 12:31:36 PDT 2009
Revision: 480
http://trac.macosforge.org/projects/darwinbuild/changeset/480
Author: wsiegrist at apple.com
Date: 2009-03-18 12:31:35 -0700 (Wed, 18 Mar 2009)
Log Message:
-----------
Remove dest (path) argument from remove() api since the -p PATH value is already applied to file objects by the time we need to remove them
Modified Paths:
--------------
branches/PR-6688645/darwinup/Depot.cpp
branches/PR-6688645/darwinup/File.cpp
branches/PR-6688645/darwinup/File.h
Modified: branches/PR-6688645/darwinup/Depot.cpp
===================================================================
--- branches/PR-6688645/darwinup/Depot.cpp 2009-03-18 02:24:14 UTC (rev 479)
+++ branches/PR-6688645/darwinup/Depot.cpp 2009-03-18 19:31:35 UTC (rev 480)
@@ -654,7 +654,7 @@
if (INFO_TEST(preceding->info(), FILE_INFO_NO_ENTRY)) {
state = 'R';
IF_DEBUG("[uninstall] removing file\n");
- if (actual && res == 0) res = actual->remove(context->depot->m_prefix);
+ if (actual && res == 0) res = actual->remove();
} else {
// copy the preceding file back out to the system
// if it's different from what's already there
Modified: branches/PR-6688645/darwinup/File.cpp
===================================================================
--- branches/PR-6688645/darwinup/File.cpp 2009-03-18 02:24:14 UTC (rev 479)
+++ branches/PR-6688645/darwinup/File.cpp 2009-03-18 19:31:35 UTC (rev 480)
@@ -185,7 +185,7 @@
return res;
}
-int File::remove(const char* dest) {
+int File::remove() {
// not implemented
fprintf(stderr, "%s:%d: call to abstract function File::remove\n", __FILE__, __LINE__);
return -1;
@@ -224,11 +224,10 @@
}
}
-int Regular::remove(const char* dest) {
+int Regular::remove() {
int res = 0;
- char* path;
- asprintf(&path, "%s/%s", dest, this->path());
- res = unlink(path);
+ res = unlink(this->path());
+ IF_DEBUG("[remove] unlink %s\n", this->path());
if (res == -1 && errno == ENOENT) {
// We can safely ignore this because we were going to
// remove the file anyway
@@ -236,8 +235,6 @@
} else if (res != 0) {
fprintf(stderr, "%s:%d: %s: %s (%d)\n", __FILE__, __LINE__, m_path, strerror(errno), errno);
}
-
- free(path);
return res;
}
@@ -251,11 +248,10 @@
}
}
-int Symlink::remove(const char* dest) {
+int Symlink::remove() {
int res = 0;
- char* path;
- asprintf(&path, "%s/%s", dest, this->path());
- res = unlink(path);
+ res = unlink(this->path());
+ IF_DEBUG("[remove] unlink %s", this->path());
if (res == -1 && errno == ENOENT) {
// We can safely ignore this because we were going to
// remove the file anyway
@@ -263,8 +259,6 @@
} else if (res == -1) {
fprintf(stderr, "%s:%d: %s (%d)\n", __FILE__, __LINE__, strerror(errno), errno);
}
-
- free(path);
return res;
}
@@ -308,22 +302,19 @@
return res;
}
-int Directory::remove(const char* dest) {
+int Directory::remove() {
int res = 0;
- char* path;
- asprintf(&path, "%s/%s", dest, this->path());
- res = rmdir(path);
+ res = rmdir(this->path());
+ IF_DEBUG("[remove] rmdir %s\n", this->path());
if (res == -1 && errno == ENOENT) {
// We can safely ignore this because we were going to
// remove the directory anyway
res = 0;
} else if (res == -1 && errno == ENOTEMPTY) {
- res = remove_directory(path);
+ res = remove_directory(this->path());
} else if (res == -1) {
fprintf(stderr, "%s:%d: %s (%d)\n", __FILE__, __LINE__, strerror(errno), errno);
}
-
- free(path);
return res;
}
Modified: branches/PR-6688645/darwinup/File.h
===================================================================
--- branches/PR-6688645/darwinup/File.h 2009-03-18 02:24:14 UTC (rev 479)
+++ branches/PR-6688645/darwinup/File.h 2009-03-18 19:31:35 UTC (rev 480)
@@ -139,8 +139,8 @@
// XXX: rename as repair()?
virtual int install_info(const char* dest);
- // Removes the file from the dest path
- virtual int remove(const char* dest);
+ // Removes the file
+ virtual int remove();
// Prints one line to the output stream indicating
// the file mode, ownership, digest and name.
@@ -181,7 +181,7 @@
struct Regular : File {
Regular(Archive* archive, FTSENT* ent);
Regular(uint64_t serial, Archive* archive, uint32_t info, const char* path, mode_t mode, uid_t uid, gid_t gid, off_t size, Digest* digest);
- virtual int remove(const char* dest);
+ virtual int remove();
};
////
@@ -192,7 +192,7 @@
Symlink(Archive* archive, FTSENT* ent);
Symlink(uint64_t serial, Archive* archive, uint32_t info, const char* path, mode_t mode, uid_t uid, gid_t gid, off_t size, Digest* digest);
virtual int install_info(const char* dest);
- virtual int remove(const char* dest);
+ virtual int remove();
};
////
@@ -203,5 +203,5 @@
Directory(Archive* archive, FTSENT* ent);
Directory(uint64_t serial, Archive* archive, uint32_t info, const char* path, mode_t mode, uid_t uid, gid_t gid, off_t size, Digest* digest);
virtual int install(const char* prefix, const char* dest);
- virtual int remove(const char* dest);
+ virtual int remove();
};
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/darwinbuild-changes/attachments/20090318/c27adc1c/attachment.html>
More information about the darwinbuild-changes
mailing list