get-tar-commit-id.con commit Merge branch 'jc/read-tree-safety' (0081e36)
   1/*
   2 * Copyright (C) 2005 Rene Scharfe
   3 */
   4#include <stdio.h>
   5#include <string.h>
   6#include <unistd.h>
   7
   8#define HEADERSIZE      1024
   9
  10int main(int argc, char **argv)
  11{
  12        char buffer[HEADERSIZE];
  13        ssize_t n;
  14
  15        n = read(0, buffer, HEADERSIZE);
  16        if (n < HEADERSIZE) {
  17                fprintf(stderr, "read error\n");
  18                return 3;
  19        }
  20        if (buffer[156] != 'g')
  21                return 1;
  22        if (memcmp(&buffer[512], "52 comment=", 11))
  23                return 1;
  24        n = write(1, &buffer[523], 41);
  25        if (n < 41) {
  26                fprintf(stderr, "write error\n");
  27                return 2;
  28        }
  29        return 0;
  30}