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

dpkg-split: Properly check error condition on open when splitting

Guillem Jover лет назад: 17
Родитель
Сommit
2a7cbd9bba
1 измененных файлов с 2 добавлено и 1 удалено
  1. 2 1
      dpkg-split/split.c

+ 2 - 1
dpkg-split/split.c

@@ -62,7 +62,8 @@ void do_split(const char *const *argv) {
   sprintf(partsizebuf,"%ld",maxpartsize-HEADERALLOWANCE);
   sprintf(partsizeallowbuf,"%ld",maxpartsize);
   fd= open(sourcefile,O_RDONLY);
-  if (!fd) ohshite(_("unable to open source file `%.250s'"),sourcefile);
+  if (fd < 0)
+    ohshite(_("unable to open source file `%.250s'"), sourcefile);
   if (fstat(fd,&stab)) ohshite(_("unable to fstat source file"));
   if (!S_ISREG(stab.st_mode)) ohshit(_("source file `%.250s' not a plain file"),sourcefile);
   sprintf(lengthbuf,"%lu",(unsigned long)stab.st_size);