Просмотр исходного кода

dpkg-split: Do not include trailing slash in PARTSDIR

Guillem Jover лет назад: 15
Родитель
Сommit
4aadfe74c5
3 измененных файлов с 5 добавлено и 16 удалено
  1. 1 1
      dpkg-split/dpkg-split.h
  2. 0 10
      dpkg-split/main.c
  3. 4 5
      dpkg-split/queue.c

+ 1 - 1
dpkg-split/dpkg-split.h

@@ -73,7 +73,7 @@ void addtopartlist(struct partinfo**, struct partinfo*, struct partinfo *refi);
 
 #define SPLITVERSION       "2.1"
 
-#define PARTSDIR          "parts/"
+#define PARTSDIR          "parts"
 
 #define PARTMAGIC         "debian-split"
 #define HEADERALLOWANCE    1024

+ 0 - 10
dpkg-split/main.c

@@ -151,8 +151,6 @@ static const struct cmdinfo cmdinfos[]= {
 
 int main(int argc, const char *const *argv) {
   int ret;
-  int l;
-  char *p;
 
   setlocale(LC_ALL, "");
   bindtextdomain(PACKAGE, LOCALEDIR);
@@ -164,14 +162,6 @@ int main(int argc, const char *const *argv) {
 
   if (!cipaction) badusage(_("need an action option"));
 
-  l = strlen(opt_depotdir);
-  if (l && opt_depotdir[l - 1] != '/') {
-    p= nfmalloc(l+2);
-    strcpy(p, opt_depotdir);
-    strcpy(p+l,"/");
-    opt_depotdir = p;
-  }
-
   setvbuf(stdout,NULL,_IONBF,0);
 
   ret = cipaction->action(argv);

+ 4 - 5
dpkg-split/queue.c

@@ -98,9 +98,8 @@ void scandepot(void) {
     pq->info.arch = NULL;
     pq->info.orglength= pq->info.thispartoffset= pq->info.thispartlen= 0;
     pq->info.headerlen= 0;
-    p = nfmalloc(strlen(opt_depotdir) + strlen(de->d_name) + 1);
-    strcpy(p, opt_depotdir);
-    strcat(p,de->d_name);
+    p = nfmalloc(strlen(opt_depotdir) + 1 + strlen(de->d_name) + 1);
+    sprintf(p, "%s/%s", opt_depotdir, de->d_name);
     pq->info.filename= p;
     if (!decompose_filename(de->d_name,pq)) {
       pq->info.md5sum= NULL;
@@ -171,8 +170,8 @@ do_auto(const char *const *argv)
     int ap;
     char *p, *q;
 
-    m_asprintf(&p, "%st.%lx", opt_depotdir, (long)getpid());
-    m_asprintf(&q, "%s%s.%jx.%x.%x", opt_depotdir, refi->md5sum,
+    m_asprintf(&p, "%s/t.%lx", opt_depotdir, (long)getpid());
+    m_asprintf(&q, "%s/%s.%jx.%x.%x", opt_depotdir, refi->md5sum,
                (intmax_t)refi->maxpartlen, refi->thispartn, refi->maxpartn);
 
     fd_src = open(partfile, O_RDONLY);