~ubuntu-branches/ubuntu/raring/procps/raring-proposed

« back to all changes in this revision

Viewing changes to debian/patches/30_readproc_c.dpatch

  • Committer: Bazaar Package Importer
  • Author(s): Craig Small
  • Date: 2004-04-13 07:59:25 UTC
  • Revision ID: james.westby@ubuntu.com-20040413075925-p912qrtzn1b8cc3x
Tags: 1:3.2.1-2
* Fix Makefile patch so it works  with newer patch packages 
  Closes: #242574
* Changed the way SHARED is used in Makefiles
* init script looks nicer when setting multiple variables Closes: #241721

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#! /bin/sh -e
 
2
## 30_readproc_c.dpatch by Craig Small <csmall@debian.org>
 
3
##
 
4
## All lines beginning with `## DP:' are a description of the patch.
 
5
## DP: readproc.c some type conversion help
 
6
## DP: return if unable to open /proc
 
7
 
 
8
[ -f debian/patches/00patch-opts ] && . debian/patches/00patch-opts
 
9
patch_opts="${patch_opts:--f --no-backup-if-mismatch}"
 
10
 
 
11
if [ $# -ne 1 ]; then
 
12
    echo >&2 "`basename $0`: script expects -patch|-unpatch as argument"
 
13
    exit 1
 
14
fi
 
15
case "$1" in
 
16
       -patch) patch $patch_opts -p1 < $0;;
 
17
       -unpatch) patch $patch_opts -p1 -R < $0;;
 
18
        *)
 
19
                echo >&2 "`basename $0`: script expects -patch|-unpatch as argum
 
20
ent"
 
21
                exit 1;;
 
22
esac
 
23
 
 
24
exit 0
 
25
@DPATCH@
 
26
--- procps-3.2.0.orig/proc/readproc.c
 
27
+++ procps-3.2.0/proc/readproc.c
 
28
@@ -162,7 +162,7 @@
 
29
         // examine a field name (hash and compare)
 
30
     base:
 
31
         if(unlikely(!*S)) break;
 
32
-        entry = table[63 & (asso[S[3]] + asso[S[2]] + asso[S[0]])];
 
33
+        entry = table[63 & (asso[(int)S[3]] + asso[(int)S[2]] + asso[(int)S[0]])];
 
34
         colon = strchr(S, ':');
 
35
         if(unlikely(!colon)) break;
 
36
         if(unlikely(colon[1]!='\t')) break;
 
37
@@ -888,6 +888,8 @@
 
38
     else
 
39
        PT = openproc(flags);
 
40
     va_end(ap);
 
41
+    if (!PT)
 
42
+      return 0;
 
43
     do {                                       /* read table: */
 
44
        tab = xrealloc(tab, (n+1)*sizeof(proc_t*));/* realloc as we go, using */
 
45
        tab[n] = readproc_direct(PT, NULL);     /* final null to terminate */