~ubuntu-core-dev/update-notifier/ubuntu

« back to all changes in this revision

Viewing changes to src/hook-remove.c

  • Committer: Andrea Azzarone
  • Date: 2019-03-13 10:05:20 UTC
  • mto: This revision was merged to the branch mainline in revision 956.
  • Revision ID: azzaronea@gmail.com-20190313100520-024zyxvlpm81vgrq
Add livepatch status icons.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/* hook-remove.c - a simple application that can remove hook files from
 
2
 *                 the file system
 
3
 * Copyright (C) 2005 Canonical
 
4
 *
 
5
 * This library is free software; you can redistribute it and/or
 
6
 * modify it under the terms of the GNU Lesser General Public
 
7
 * License as published by the Free Software Foundation; either
 
8
 * version 2 of the License, or (at your option) any later version.
 
9
 *
 
10
 * This library is distributed in the hope that it will be useful,
 
11
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 
12
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 
13
 * Lesser General Public License for more details.
 
14
 *
 
15
 * You should have received a copy of the GNU Lesser General Public
 
16
 * License along with this library; if not, write to the
 
17
 * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor
 
18
 * Boston, MA  02110-1301 USA.
 
19
 */
 
20
 
 
21
#include <stdlib.h>
 
22
#include <stdio.h>
 
23
#include <unistd.h>
 
24
 
 
25
#define HOOK_PATH "/var/lib/update-notifier/user.d"
 
26
 
 
27
int main(int argc, char *argv[])
 
28
{
 
29
   int i;
 
30
 
 
31
   if(chdir(HOOK_PATH) < 0)
 
32
   {
 
33
      perror("chdir");
 
34
      exit(1);
 
35
   }
 
36
 
 
37
   if(chroot(HOOK_PATH) < 0) 
 
38
   {
 
39
      perror("chroot");
 
40
      exit(1);
 
41
   }
 
42
   
 
43
   for(i=1; i<argc; i++)
 
44
   {
 
45
      unlink(argv[i]);
 
46
   }
 
47
   exit(0);
 
48
}